SwipeUI

Chip group

Chips that wrap with gliding neighbours, fold behind "+N more" without hiding chosen ones, or scroll in one soft-edged row; single or multiple, with a limit and long-press "only this".

npx @swipeui/cli add chip-group
Variant
Preset
Material
Scheme
Feel
Real free component with a browser animation bridge. Native motion, haptics and materials need a device.

When to use it

  • Filter rows above a list, such as cuisines, sizes or categories.
  • Picking several interests during onboarding.
  • Single-choice pills when a segmented control is too rigid.
  • Choices that should wrap onto several lines on small screens.

When not to use it

  • A handful of options that switch a view. Use Segmented control.
  • Long lists of options. Use Multi-select.
  • Free-form tags people type. Use Tag input.

Installation

Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.

npx @swipeui/cli add chip-group
  • Adds components/swipeui/ui/chip-group.tsx, components/swipeui/ui/use-chip-group.ts and 14 shared helpers.
  • Installs react-native-reanimated, clsx, tailwind-merge, react-native-worklets, uniwind, expo-haptics, class-variance-authority, react-native-svg, react-native-gesture-handler. In Expo apps it uses npx expo install so versions match your SDK.

Usage

app/filters.tsx
import { ChipGroup } from '@/components/swipeui/ui/chip-group';

<ChipGroup
  accessibilityLabel="Cuisines"
  options={[
    { value: 'italian', label: 'Italian' },
    { value: 'japanese', label: 'Japanese' },
  ]}
/>;

Examples

Fold long sets behind "+N more" (chosen chips stay visible) and allow at most three:

<ChipGroup accessibilityLabel="Cuisines" options={cuisines} maxVisible={5} max={3} />

One scrolling row for categories, with soft edges in the card's colour:

<ChipGroup type="single" layout="scroll" options={categories} fadeClassName="bg-card" />

API reference

ChipGroupProps

PropTypeDefaultDescription
optionsreadonly ChipOption<T>[]—

The chips, in order.

value?readonly T[]—

The chosen values (controlled), in option order.

defaultValue?readonly T[][]

The values chosen at first (uncontrolled).

onValueChange?((value: readonly T[]) => void)—

Reports the chosen values, in option order.

type?"multiple" | "single"'multiple'

One chip at a time, or several.

selectionMode?"multiple" | "single"—

1.x name for type (single also lets a second tap clear it).

clearable?booleanfalse (true with 1.x `selectionMode`)

Single: a second tap on the chosen chip clears it.

max?numberunlimited

Multiple: the most that can be chosen. An extra tap shakes, plays a limit haptic and is announced once.

layout?"scroll" | "wrap"'wrap'

wrap onto lines, or ★ scroll in one row with soft edges that follows the chosen chip.

maxVisible?numberall

Wrap: fold chips past this many behind a "+N more" chip. Chosen chips always stay visible.

soloOnLongPress?booleantrue

★ Multiple: long-press a chip to choose it alone, with an impact haptic.

variant?ChipVariant'tinted'

Chips at rest.

tone?ChipTone'neutral'

Chips' colour at rest.

selectedVariant?ChipVariant'solid'

Chosen chips' look.

selectedTone?ChipTone'primary'

Chosen chips' colour.

size?ChipSize'md'

Chip size.

shape?ChipShape'preset'

Chip shape.

check?booleantrue

Chosen chips draw a check on.

fadeClassName?string'bg-background'

Scroll: the colour class of the soft edges; match the surface behind the row.

disabled?booleanfalse

No choosing.

haptics?boolean | SelectionHapticstrue

Haptics: a switch, or per part (toggle, select for a long press, limit at max).

messages?Partial<ChipGroupMessages>English

Built-in strings.

motion?MotionOverridethe app's feel

Chip, layout and reveal motion.

accessibilityLabel?string—

Spoken group name.

className?string—

Root classes.

style?StyleProp<ViewStyle>—

Root style.

testID?string—

Root identifier; chips append -<value>, the more chip -more.

Options are SelectionOptions from selection-core: value, label, icon (a node or ({ color, size }) => node), disabled and disabledReason.

Composition and behavior

  • Chosen chips draw their check on and the label slides over; neighbours glide aside, even across lines, and the group's height follows.
  • maxVisible folds the rest behind "+N more". Chips chosen past the fold stay visible. Tapping it reveals the rest one after another; "Show less" folds them again.
  • ★ layout="scroll" keeps one row. Soft edges show where there's more, and choosing a chip near an edge scrolls it into view.
  • ★ In multiple mode, a long press keeps only that chip (announced as "Only Italian"). Every chip can still be tapped one at a time.
  • max refuses an extra pick: the chip shakes once, a warning haptic plays and the limit is announced.
  • 1.x: selectionMode still works (single lets a second tap clear, like clearable).

Chip group settings

PropDoesDefault
typesingle or multiple (1.x selectionMode)multiple
clearableSingle: a second tap clearsfalse
maxThe most that can be chosenunlimited
layoutwrap or ★ scrollwrap
maxVisibleFold the rest behind "+N more"all
soloOnLongPress★ Long-press for "only this"true
variant / tone / selectedVariant / selectedToneChip looks, as Chiptinted, neutral, solid, primary
size / shape / checkChip size, corners and checkmd, preset, true
fadeClassNameScroll edges' surface colourbg-background
disabledNo choosingfalse
hapticsAll, or { toggle, select, limit }on
messages"+n more", "Show less", "Only …", the limitEnglish

Behavior and gestures

  • Tap chips to choose or unchoose them; values come back in option order. A chosen chip draws its check on and its neighbours glide aside, even across lines.
  • `type="single"`: choosing a chip replaces the last; with `clearable`, a second tap clears it.
  • `maxVisible` folds the rest behind "+N more"; chosen chips past the fold stay visible. Tapping it reveals the rest with a stagger and "Show less" folds them again.
  • ★ `layout="scroll"`: one row with soft edges where there's more, scrolling the chosen chip into view.
  • ★ Multiple: long-press a chip to choose it alone, with an impact haptic (`soloOnLongPress`).
  • `max` refuses an extra pick: the chip shakes, a warning haptic plays and "You can choose up to n" is announced.

Accessibility

  • Each chip is a toggle button with checked state; a disabled chip speaks its `disabledReason` (or Unavailable) as the hint. Name the set with `accessibilityLabel`, such as "Cuisines".
  • Long-press "only this" is announced ("Only Italian"); every chip can still be tapped one by one.
  • Chips keep 44pt touch targets; the more chip is a button.

Motion

  • Uses the toggle, layout, list and press motion roles, so it follows your app's feel. Pass motion to tune this one instance.
  • Neighbours and the group's height glide on the layout spring; revealed chips fade in one after another on the list role; checks draw on the toggle role.
  • Reduce Motion: no gliding or stagger (chips appear in place), checks appear without drawing, and the scroll jumps.

Performance

  • Only changed chips re-render; scroll offsets are tracked without re-running the scroll-into-view.

Notes for AI

  • Value is always an array. Use `type="single"` for one choice (1.x `selectionMode` still works and lets a second tap clear).
  • Options are `SelectionOption`s (`icon` takes a node or a render function, `disabledReason`). Chip looks pass through: `variant`, `tone`, `selectedVariant`, `selectedTone`, `size`, `shape`, `check`.

Compatibility

Runs onSupported
Expo SDK 57Yes
Expo SDK 58Yes
React Native CLI (with Expo modules)Yes
Expo GoYes
iOSYes
AndroidYes

This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.

Related items