From 46a9adc246464ea0e21770ca882c949f88a341a8 Mon Sep 17 00:00:00 2001 From: Charles de Dreuille Date: Tue, 10 Feb 2026 11:08:06 +0000 Subject: [PATCH] Improve docs + container props on Grid + Flex Signed-off-by: Charles de Dreuille --- .changeset/alert-remove-surface.md | 12 ++++ .changeset/clean-bags-occur.md | 17 ++---- .../ui/src/components/Flex/Flex.stories.tsx | 19 +++--- packages/ui/src/components/Flex/Flex.tsx | 7 ++- .../ui/src/components/Grid/Grid.stories.tsx | 11 ++-- packages/ui/src/components/Grid/Grid.tsx | 14 +++-- .../components/ToggleButton/ToggleButton.tsx | 4 -- packages/ui/src/hooks/useBg.tsx | 60 +++++++------------ 8 files changed, 66 insertions(+), 78 deletions(-) create mode 100644 .changeset/alert-remove-surface.md diff --git a/.changeset/alert-remove-surface.md b/.changeset/alert-remove-surface.md new file mode 100644 index 0000000000..ed32bd38d2 --- /dev/null +++ b/.changeset/alert-remove-surface.md @@ -0,0 +1,12 @@ +--- +'@backstage/ui': minor +--- + +**BREAKING**: Alert no longer accepts a `surface` prop + +The Alert component's background is now driven entirely by its `status` prop. The `surface` prop has been removed. + +```diff +- ++ +``` diff --git a/.changeset/clean-bags-occur.md b/.changeset/clean-bags-occur.md index 37325426e1..d3623a9a9d 100644 --- a/.changeset/clean-bags-occur.md +++ b/.changeset/clean-bags-occur.md @@ -4,7 +4,7 @@ **BREAKING**: Replaced `Surface` / `onSurface` system with new `ContainerBg` background system -The old `Surface` type (`'0'`–`'3'`, `'auto'`) and its associated props (`surface`, `onSurface`) have been replaced by a new `ContainerBg` type with semantic neutral levels (`'neutral-1'` through `'neutral-3'`) and intents (`'danger'`, `'warning'`, `'success'`). Containers are capped at `neutral-3`; the `neutral-4` level is reserved for leaf component CSS only. Leaf components like Button no longer need an explicit prop — they receive a `data-on-bg` attribute matching the parent container's bg, and CSS handles the visual step-up. +The old `Surface` type (`'0'`–`'3'`, `'auto'`) and its associated props (`surface`, `onSurface`) have been replaced by `ContainerBg` — a union of `'neutral-1'` | `'neutral-2'` | `'neutral-3'` | `'danger'` | `'warning'` | `'success'`. There is no `neutral-4` value; containers are capped at `neutral-3`. Leaf components like Button no longer accept a bg prop — they inherit the parent container's bg via a `data-on-bg` attribute, and CSS handles the visual step-up to the next neutral level. New `useBg` hook and `BgProvider` replace the deleted `useSurface` hook and `SurfaceProvider`. @@ -26,7 +26,7 @@ Rename the `surface` prop to `bg` on container components and update values: + ``` -Remove `onSurface` from leaf components — it is now fully automatic: +Remove `onSurface` from leaf components — they now always inherit from the parent container and can no longer override the value: ```diff -