Repository navigation
Refresh Button with the SegmentedControls rim light (4.11.0) - #182
Conversation
…nButton - DateRangePicker: day cells drop the bordered-box grid. Selected days use the primary button colours (dark mode was 2.3:1, now meets AA), in-range days the primary badge tint, and hover the IconButton lilac tint, through its own hover rule rather than Button's. - DropdownMenu: checked radio and checkbox items use the primary fill, so RadioDropdown and FilterDropdown match Checkbox and RadioGroup. - RadioGroup: the checked dot is back to 10px. - IconButton: md and lg corners match Button's 6px. - ToastAction is built on Button instead of a copy of its styles. - Badge's close button opts out of shadows and hover a future tertiary Button could add. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ames A selected range passed the whole CSS module object to cn, which added every key in it as an unhashed class. Left over from #51 removing popover-trigger--active. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… dark mode Lightening the primary fill by 14% put the day's white text at about 4.0:1. 6% lightens it visibly and keeps 4.74:1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Filled variants get a soft top sheen, a tinted lift and no visible border. Tertiary gets the same sheen and lift with a translucent edge, staying near black in dark mode. Every variant except link and navigation has a pressed state, transitions use SegmentedControls' easing and respect reduced motion, and the icon gap is 6px. Dark-mode hover lightens filled variants by 6% so white labels stay above 4.5:1, and the sheen ends at 35% so it never sits behind a label. Badge's close button and DateRangePicker's day cells, both built on tertiary, opt out of the sheen; a selected day matches the new filled Button. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Following design review, filled variants get the sharp 1px rim light of the SegmentedControls active segment over a softer sheen, with a subtler drop shadow. They lose their border so the rim sits on the edge, with 1px more padding so they stay the same size. Tertiary is white in light mode and near black in dark, where its brighter top edge is the rim light. A selected DateRangePicker day matches, and a danger toast keeps the border it gives its ToastAction. Released as a minor version: no props, variants or sizes change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@tmccoy14 IMO it certainly looks nice. @tmccoy14 and @Shrinks99 one ask and and two questions. Lift the filled-button shadow into a shared token. The same shadow is now written out twice: button.module.css lines 23–24 and date-range-picker.module.css lines 96–97. Something like this, in the @theme inline block of theme-base.css: --shadow-control-raised: 0 1px 2px rgb(0 0 0 / 0.18), Should SegmentedControls move onto it here? Its shadow would change from 0.2 to 0.18 in light mode and from 0.2 to 0.45 in dark mode. Does the fill-coloured glow need to stay? Without it, dark mode doesn't need its own token. |
# Conflicts: # packages/ui/CHANGELOG.md # packages/ui/package.json
Button and the selected DateRangePicker day wrote the same shadow out twice. Both now use shadow-control-raised and its dark counterpart. No visual change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ol shadow The active segment now shares shadow-control-raised with Button and the selected DateRangePicker day. Its drop shadow goes from 0.2 to 0.18 in light mode and 0.45 in dark, which screenshots show no visible change against the black dark-mode track. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@matthewmr-eqty thanks, all three addressed: Shared token. Lifted into SegmentedControls. Moved onto the token too (376aa9c). I screenshotted it before and after at 3x and diffed them: dark mode is pixel-identical, since the track behind the indicator is pure black, and light mode differs by at most 4/255 on a channel. Worth remembering for MIC-80: if the dark track ever gets lighter, the 0.45 shadow will start to show. The indicator doesn't set
|
|
Shadows not showing in dark mode is natural and we should come up with some more component shading tokens / a better system than elevation to account for it. My going thought for interactive elements like this is that rim lights help distinguish buttons and clickable stuff in dark mode, and shadows do the same for light mode. |
matthewmr-eqty
left a comment
There was a problem hiding this comment.
Looks great. The next pass of moving shadow colours into Pinwheel can happen in MIC-80.
…hat can hover Button's edge colours, sheens, shadows and easing move into theme tokens that SegmentedControls and the selected DateRangePicker day now share, so each value is written once. Hover colours on Button, DateRangePicker days and Badge's close button only apply under (hover: hover), so a tapped control no longer stays highlighted on a touch screen. The filled-button 1px padding is a variable the size rules read, so it no longer depends on rule order. A selected day gets the filled pressed state, and the SegmentedControls track uses tertiary's translucent edge. The danger Toast action uses an inset ring so it stays as wide as in other toasts, and its hover takes the danger button tokens instead of raw red palette classes. A :focus rule that could never apply is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…led variant Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@Shrinks99 Agreed, and this PR mostly follows that already: dark mode leans on the 1px rim (filled buttons, the active segment, and tertiary's brighter top edge), and light mode leans on the drop shadow and tint, which is dropped in dark. One nuance for MIC-80: dark drop shadows aren't fully invisible. On For the token system, rather than elevation levels, how about tokens by role ( |
|
Didn't have a chance to catch this before it got merged, but the rim light on the tertiary button style has a different cut-off effect compared to the rest of the styles, presumably due to the border?
There's a few different ways we can fix this, would address when we get to tokenizing this @matthewmr-eqty |


Why
Buttonwas the component that made Equality, and Governance Studio especially, look dated. Primary and danger were flat, heavy blocks, and tertiary looked like a form field. This brings Button in line with theSegmentedControlsactive segment. The only new values are control-surface tokens intheme-base.css, built from existing Pinwheel colours: edge colours, sheens, shadows and an easing curve. They're shared withSegmentedControlsand the selectedDateRangePickerday.No props, variants or sizes change, and consumers don't need to change any code, so it's released as 4.11.0. Components built on
Buttonpick up the new look:RadioDropdown,FilterDropdown,SortSelector,DateRangePickerandPagination.What
Filled variants (
primary,danger,warning,secondary):SegmentedControls: a sharp 1px highlight (inset 0 1px 0, no blur) along the top edge.Tertiary:
button-tertiary-fill.control-edge:text-primaryat 16%, 22% in dark mode) replaces the grey border token. TheSegmentedControlstrack uses the same edge. In dark mode the top of that edge is brighter (34%) and acts as the rim light.Every variant except
linkandnavigation:SegmentedControls' 250ms easing, animate only colour, shadow and underline (nottransition-all), and respect reduced motion.Visual comparison
Main vs this branch has side-by-side screenshots of
origin/mainand this branch, in light and dark mode. It covers every Button variant and state (rest, hover, pressed and keyboard focus),SegmentedControls, an openDateRangePickerwith a range selected, the dangerToast, and the components built on Button. The link is only open to people it has been shared with.The docs have no danger toast with an action, so for those two shots the with-action toast's variant class was swapped to danger in the page. Each side's CSS is real.
Accessibility
Contrast was measured from rendered pixels behind the label:
focus-ring. A rawbox-shadowwould replace it, andbutton.module.csscarries a comment warning about that.Already broken on
main, not fixed here:warninghas white text on yellow at 2.41:1. Fixing it means changingbutton-warning-textin Pinwheel. The comment above.button--warningalso says its text is dark, which is no longer true.Other files
badge.module.cssanddate-range-picker.module.css: the Badge close button and the calendar day cells are built on tertiary, so they setbg-noneto opt out of the sheen. Their hover colours are also limited to devices that can hover.segmented-controls.module.css: the track uses tertiary's translucent edge, and the active segment uses the shared raised shadow. That tints it faintly in light mode and deepens its shadow in dark.button.mdx: typo fixes, the variants intro moved into the overview, and disabledwarningandlinkexamples.date-range-picker.module.css: a selected day matches the new filled Button: no border, rim light, sheen, shadow and pressed state.toast-components.module.css: a danger toast outlines itsToastActionwith an inset ring instead of a border, so the action is as wide as in other toasts. Hovering the toast turns the action thedangerbutton colours instead of raw red palette classes.For consumers
bg-none!next to abg-*!colour class gets merged away by tailwind-merge incn(). Use[background-image:none]!instead.borderas well.DateTimePickerforces the field look on its trigger, and is updated to also switch off the sheen and lift. That change lives in the guardian repo.🤖 Generated with Claude Code