Repository navigation
Conversation
Owner
|
This is great. The only concern I have: |
Contributor
Author
|
I would say this can act as a toolbar / controls bar. |
pdanpdan
force-pushed
the
feat/segmented-control
branch
from
November 17, 2026 12:05
80faaaf to
76e4e80
Compare
- segments are native radios: a label wrapping the input, or an input with aria-label, so the group name and arrow keys work without JS - the track is base-200 like tabs-box and the selected segment is a base-100 chip with a 1px base-content/20 border and the depth shadow; the border is reserved on every segment, so selecting one does not move the other labels - radius stay concentric: track = radius-field + padding, chip = radius-field, so pill themes get a pill chip and 0-radius themes stay square - optional `segmented-control-indicator` anchors to the checked radio with CSS anchor positioning, so the selection slides between segments with transition (from megamenu); without anchor positioning the indicator is not rendered and the checked segment paints its own chip - color classes (primary, secondary, accent, neutral, success, warning, info, error) paint the chip and the indicator with that color and switch the label to the matching content color - sizes xs..xl follow the field size scale - forced-colors marks the selected segment with a 1px frame and leaves the palette to the browser; the focus ring is not overridden by that frame example: https://play.tailwindcss.com/kr6ptonJwP
pdanpdan
force-pushed
the
feat/segmented-control
branch
from
November 17, 2026 12:20
76e4e80 to
b1020f1
Compare
- `.segmented-control-delimited` / `.segmented-control-item-delimited` draw separators between segments - `.segmented-control-joined` removes gaps so segments touch with only the outer corners rounded - items and the indicator now inherit the control's radius - nested controls use a transparent track so the indicator moving stays visible example: https://play.tailwindcss.com/f892BIOdLK
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
segmented-control-indicatoranchors to the checked radio with CSS anchor positioning, so the selection slides between segments with transition (from megamenu); without anchor positioning the indicator is not rendered and the checked segment paints its own chipexample:
v1:
https://play.tailwindcss.com/RKdNbjFQ4rv2:
https://play.tailwindcss.com/S2w2xgrqhp- accept checkboxes (disables animation if mixed - but can be composed)v3:
https://play.tailwindcss.com/EoeuMXy5l6- improved examples (and small fixes)v4: https://play.tailwindcss.com/f892BIOdLK - add dividers and joined mode