Segment
A segmented control component for toggling between mutually exclusive options, with a smooth animated sliding indicator.
Component Features
- 🎨 Smooth Animation: Features a smooth animated sliding indicator.
- 📏 Multiple Sizes: Supports
sm,md(default),lgsize specs. - ❌ Disabled State: Supports disabling the entire group or individual options.
- 🖼️ Icon Support: Supports icons via
BrIconor inline content. - 🌗 Dark Mode: Based on
BrConfigProviderfor automatic dark mode adaptation. - 🎨 Theme Customization: Supports global theme configuration and TailwindCSS local overrides.
Basic Usage
Sizes
Use the size prop on BrSegment to control the overall size. Available sizes: sm, md (default), lg.
Disabled
Use the disabled prop on BrSegment to disable the entire group, or on individual BrSegmentItem to disable a single option.
Icons
BrSegmentItem supports icons via BrIcon or inline content.
API
BrSegment Props
BrSegmentItem Props
BrSegment Emits
Accessibility
BrSegmenthasrole="radiogroup"witharia-disabledsupport- Each
BrSegmentItemhasrole="radio"witharia-checkedreflecting the active state - Keyboard navigation:
ArrowLeft/ArrowRightto move between items,Home/Endfor first/last - Focus management: only the active item is in the tab order