Chip Tabs
A tab component displayed in chip form. It is used to switch content by selecting categories or filters.
<viewpager><viewpager-item>Installation
Install dependencies
Copy the code below and paste it in
Props
ChipTabsRoot
Prop
Type
value?string | undefineddefaultValue?string | undefinedonValueChange?((value: string) => void) | undefinedstyle?CSSProperties | undefinedchildren?ReactNodeclassName?string | undefinedChipTabsList
Prop
Type
style?CSSProperties | undefinedchildren?ReactNodeclassName?string | undefinedmain-thread:bindbgload?EventHandler<BaseImageLoadEvent<Element>> | undefinedmain-thread:catchbgload?EventHandler<BaseImageLoadEvent<Element>> | undefinedmain-thread:capture-bindbgload?EventHandler<BaseImageLoadEvent<Element>> | undefinedmain-thread:capture-catchbgload?EventHandler<BaseImageLoadEvent<Element>> | undefinedmain-thread:global-bindbgload?EventHandler<BaseImageLoadEvent<Element>> | undefinedmain-thread:bindbgerror?EventHandler<BaseImageErrorEvent<Element>> | undefinedmain-thread:catchbgerror?EventHandler<BaseImageErrorEvent<Element>> | undefinedmain-thread:capture-bindbgerror?EventHandler<BaseImageErrorEvent<Element>> | undefinedmain-thread:capture-catchbgerror?EventHandler<BaseImageErrorEvent<Element>> | undefinedmain-thread:global-bindbgerror?EventHandler<BaseImageErrorEvent<Element>> | undefinedmain-thread:bindtouchstart?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:catchtouchstart?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:capture-bindtouchstart?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:capture-catchtouchstart?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:global-bindtouchstart?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:bindtouchmove?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:catchtouchmove?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:capture-bindtouchmove?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:capture-catchtouchmove?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:global-bindtouchmove?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:bindtouchcancel?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:catchtouchcancel?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:capture-bindtouchcancel?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:capture-catchtouchcancel?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:global-bindtouchcancel?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:bindtouchend?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:catchtouchend?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:capture-bindtouchend?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:capture-catchtouchend?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:global-bindtouchend?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:bindlongpress?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:catchlongpress?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:capture-bindlongpress?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:capture-catchlongpress?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:global-bindlongpress?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:bindtransitionstart?EventHandler<BaseTransitionEvent<Element>> | undefinedmain-thread:catchtransitionstart?EventHandler<BaseTransitionEvent<Element>> | undefinedmain-thread:capture-bindtransitionstart?EventHandler<BaseTransitionEvent<Element>> | undefinedmain-thread:capture-catchtransitionstart?EventHandler<BaseTransitionEvent<Element>> | undefinedmain-thread:global-bindtransitionstart?EventHandler<BaseTransitionEvent<Element>> | undefinedmain-thread:bindtransitioncancel?EventHandler<BaseTransitionEvent<Element>> | undefinedmain-thread:catchtransitioncancel?EventHandler<BaseTransitionEvent<Element>> | undefinedmain-thread:capture-bindtransitioncancel?EventHandler<BaseTransitionEvent<Element>> | undefinedmain-thread:capture-catchtransitioncancel?EventHandler<BaseTransitionEvent<Element>> | undefinedmain-thread:global-bindtransitioncancel?EventHandler<BaseTransitionEvent<Element>> | undefinedmain-thread:bindtransitionend?EventHandler<BaseTransitionEvent<Element>> | undefinedmain-thread:catchtransitionend?EventHandler<BaseTransitionEvent<Element>> | undefinedmain-thread:capture-bindtransitionend?EventHandler<BaseTransitionEvent<Element>> | undefinedmain-thread:capture-catchtransitionend?EventHandler<BaseTransitionEvent<Element>> | undefinedmain-thread:global-bindtransitionend?EventHandler<BaseTransitionEvent<Element>> | undefinedmain-thread:bindanimationstart?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:catchanimationstart?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:capture-bindanimationstart?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:capture-catchanimationstart?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:global-bindanimationstart?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:bindanimationiteration?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:catchanimationiteration?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:capture-bindanimationiteration?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:capture-catchanimationiteration?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:global-bindanimationiteration?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:bindanimationcancel?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:catchanimationcancel?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:capture-bindanimationcancel?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:capture-catchanimationcancel?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:global-bindanimationcancel?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:bindanimationend?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:catchanimationend?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:capture-bindanimationend?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:capture-catchanimationend?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:global-bindanimationend?EventHandler<BaseAnimationEvent<Element>> | undefinedmain-thread:bindmousedown?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:catchmousedown?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:capture-bindmousedown?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:capture-catchmousedown?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:global-bindmousedown?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:bindmouseup?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:catchmouseup?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:capture-bindmouseup?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:capture-catchmouseup?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:global-bindmouseup?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:bindmousemove?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:catchmousemove?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:capture-bindmousemove?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:capture-catchmousemove?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:global-bindmousemove?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:bindmouseenter?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:catchmouseenter?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:capture-bindmouseenter?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:capture-catchmouseenter?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:global-bindmouseenter?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:bindmouseleave?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:catchmouseleave?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:capture-bindmouseleave?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:capture-catchmouseleave?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:global-bindmouseleave?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:bindmouseclick?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:catchmouseclick?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:capture-bindmouseclick?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:capture-catchmouseclick?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:global-bindmouseclick?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:bindmousedblclick?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:catchmousedblclick?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:capture-bindmousedblclick?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:capture-catchmousedblclick?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:global-bindmousedblclick?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:bindmouselongpress?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:catchmouselongpress?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:capture-bindmouselongpress?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:capture-catchmouselongpress?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:global-bindmouselongpress?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:bindwheel?EventHandler<BaseWheelEvent<Element>> | undefinedmain-thread:catchwheel?EventHandler<BaseWheelEvent<Element>> | undefinedmain-thread:capture-bindwheel?EventHandler<BaseWheelEvent<Element>> | undefinedmain-thread:capture-catchwheel?EventHandler<BaseWheelEvent<Element>> | undefinedmain-thread:global-bindwheel?EventHandler<BaseWheelEvent<Element>> | undefinedmain-thread:bindzoom?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:catchzoom?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:capture-bindzoom?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:capture-catchzoom?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:global-bindzoom?EventHandler<BaseMouseEvent<Element>> | undefinedmain-thread:bindkeydown?EventHandler<BaseKeyEvent<Element>> | undefinedmain-thread:catchkeydown?EventHandler<BaseKeyEvent<Element>> | undefinedmain-thread:capture-bindkeydown?EventHandler<BaseKeyEvent<Element>> | undefinedmain-thread:capture-catchkeydown?EventHandler<BaseKeyEvent<Element>> | undefinedmain-thread:global-bindkeydown?EventHandler<BaseKeyEvent<Element>> | undefinedmain-thread:bindkeyup?EventHandler<BaseKeyEvent<Element>> | undefinedmain-thread:catchkeyup?EventHandler<BaseKeyEvent<Element>> | undefinedmain-thread:capture-bindkeyup?EventHandler<BaseKeyEvent<Element>> | undefinedmain-thread:capture-catchkeyup?EventHandler<BaseKeyEvent<Element>> | undefinedmain-thread:global-bindkeyup?EventHandler<BaseKeyEvent<Element>> | undefinedmain-thread:bindfocus?EventHandler<BaseCommonEvent<Element>> | undefinedmain-thread:catchfocus?EventHandler<BaseCommonEvent<Element>> | undefinedmain-thread:capture-bindfocus?EventHandler<BaseCommonEvent<Element>> | undefinedmain-thread:capture-catchfocus?EventHandler<BaseCommonEvent<Element>> | undefinedmain-thread:global-bindfocus?EventHandler<BaseCommonEvent<Element>> | undefinedmain-thread:bindblur?EventHandler<BaseCommonEvent<Element>> | undefinedmain-thread:catchblur?EventHandler<BaseCommonEvent<Element>> | undefinedmain-thread:capture-bindblur?EventHandler<BaseCommonEvent<Element>> | undefinedmain-thread:capture-catchblur?EventHandler<BaseCommonEvent<Element>> | undefinedmain-thread:global-bindblur?EventHandler<BaseCommonEvent<Element>> | undefinedmain-thread:bindlayoutchange?EventHandler<LayoutChangeDetailEvent<Element>> | undefinedmain-thread:catchlayoutchange?EventHandler<LayoutChangeDetailEvent<Element>> | undefinedmain-thread:capture-bindlayoutchange?EventHandler<LayoutChangeDetailEvent<Element>> | undefinedmain-thread:capture-catchlayoutchange?EventHandler<LayoutChangeDetailEvent<Element>> | undefinedmain-thread:global-bindlayoutchange?EventHandler<LayoutChangeDetailEvent<Element>> | undefinedmain-thread:binduiappear?EventHandler<UIAppearanceDetailEvent<Element>> | undefinedmain-thread:catchuiappear?EventHandler<UIAppearanceDetailEvent<Element>> | undefinedmain-thread:capture-binduiappear?EventHandler<UIAppearanceDetailEvent<Element>> | undefinedmain-thread:capture-catchuiappear?EventHandler<UIAppearanceDetailEvent<Element>> | undefinedmain-thread:global-binduiappear?EventHandler<UIAppearanceDetailEvent<Element>> | undefinedmain-thread:binduidisappear?EventHandler<UIAppearanceDetailEvent<Element>> | undefinedmain-thread:catchuidisappear?EventHandler<UIAppearanceDetailEvent<Element>> | undefinedmain-thread:capture-binduidisappear?EventHandler<UIAppearanceDetailEvent<Element>> | undefinedmain-thread:capture-catchuidisappear?EventHandler<UIAppearanceDetailEvent<Element>> | undefinedmain-thread:global-binduidisappear?EventHandler<UIAppearanceDetailEvent<Element>> | undefinedmain-thread:bindaccessibilityaction?EventHandler<AccessibilityActionDetailEvent<Element>> | undefinedmain-thread:catchaccessibilityaction?EventHandler<AccessibilityActionDetailEvent<Element>> | undefinedmain-thread:capture-bindaccessibilityaction?EventHandler<AccessibilityActionDetailEvent<Element>> | undefinedmain-thread:capture-catchaccessibilityaction?EventHandler<AccessibilityActionDetailEvent<Element>> | undefinedmain-thread:global-bindaccessibilityaction?EventHandler<AccessibilityActionDetailEvent<Element>> | undefinedmain-thread:bindtap?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:catchtap?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:capture-bindtap?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:capture-catchtap?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:global-bindtap?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:bindlongtap?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:catchlongtap?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:capture-bindlongtap?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:capture-catchlongtap?EventHandler<BaseTouchEvent<Element>> | undefinedmain-thread:global-bindlongtap?EventHandler<BaseTouchEvent<Element>> | undefinedChipTabsTrigger
Prop
Type
notification?boolean | undefineddisabled?boolean | undefinedvaluestringstyle?CSSProperties | undefinedchildrenstring | numberclassName?string | undefinedbindtap?EventHandler<BaseTouchEvent<Target>> | undefinedaccessibility-label?string | undefinedChipTabsCarousel
Prop
Type
swipeable?boolean | undefinedonSettle?(() => void) | undefinedstyle?CSSProperties | undefinedchildren?ReactNodeclassName?string | undefinedChipTabsContent
Prop
Type
valuestringstyle?CSSProperties | undefinedchildren?ReactNodeclassName?string | undefinedUsage
ChipTabsRoot can be controlled with value and onValueChange or set the initial selected value with defaultValue. The notification boolean of ChipTabsTrigger displays a small NotificationBadge at 6px spacing next to the label.
ChipTabsCarousel assembles ChipTabsCarouselCamera in the Registry, so only ChipTabsContent is passed as children. Since Carousel is a native <viewpager>, you must specify a height matching your app layout on the Carousel or Camera, and enable left/right swipe with swipeable. The range where the iOS back gesture from the left edge of the screen takes priority is set with iosBackGestureEdgeWidth.
When you need to use the Camera's native bindchange, bindwillchange, and bindoffsetchange directly in the public package API, you can compose ChipTabs.CarouselCamera. onSwipeStart, onSwipeEnd, and onSettle can be passed to Carousel to handle swipe start, end, and settle.
Scroll Alignment
The scrollAlign of ChipTabsList is how to align the selected chip to the horizontal list. You can use "nearest", "start", "center", and "end", with the default being "nearest".
"start","center", and"end"align the selected chip to the start, center, and end of the list, respectively."nearest"behaves like React Web's minimal scroll action: if the selected chip is completely visible, it maintains the current position. When the left side is cut off, it moves to the start boundary; when the right side is cut off, it moves to the end boundary only as much as needed, so it does not always align to the end like"end".
It calculates based on the actual chip width, position, and viewport, and preserves variable width chips as is. To center-align the first and last items of the list, it does not add empty space and only scrolls within the scrollable range without changing the item order.
In the example below, selecting a mode resets the selection to Label 1. Then tap Label 6 or Select 6 to verify the actual scrollAlign difference with controlled value change. If you choose nearest, omit the scrollAlign prop to also verify the default behavior.
When you reselect a chip that is already completely visible with nearest, it does not scroll. Even after manually scrolling the list, it only scrolls when the next selection requires it.
Examples
Size=Medium
The minimum height for medium is 36px.
Size=Large
The minimum height for large is 40px.
Variant=Neutral Solid
Variant=Neutral Outline
Notification
With Scroll Fog
ScrollFog is a package-only public component provided directly from the @seed-design/lynx-react package without a Registry snippet or Recipe. When you wrap ChipTabsList with ScrollFog where placement={["left", "right"]}, a default 20px fog is displayed at both edges. The internal left/right padding of 16px for the List is maintained as is.
Web Version Differences
| Item | React Web | Lynx |
|---|---|---|
| Rendering Elements | HTML div, button | Native view, text, scroll-view, viewpager |
| Tab Selection Event | onClick-based | bindtap-based, public state event is onValueChange |
| Content | Conditional div outside Root also available | Can render conditional native text based on value outside Root |
| Horizontal List | CSS overflow | Native horizontal scroll-view |
| Carousel | Web Carousel | Native <viewpager> |
Like the React example, you can render conditional native text content based on the selected value outside the Root in Lynx. No separate AppBar, screen shell, CTA, or asset is provided.
Unsupported Lynx Features
- Keyboard focus and roving focus
- RTL order and swipe direction reversal
lazyMount,unmountOnExit: native viewpager maintains all page slots.- Carousel's
loop,autoHeight,dragThreshold,carouselPreventDrag - Content transition animations