Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

PillSelector

The PillSelector component displays a wrapping list of options that can be selected, deselected, and optionally reordered.

Import

1
import { PillSelector } from '@payloadcms/ui'

Interactive example

Loading component example…

The component does not manage selection state. Update the pills array in onClick and pass the new array back to the component.

Pill shape

Each item in pills accepts:

Property

Type

Description

name *

string

Stable value and default visible label.

selected *

boolean

Whether the option is currently selected.

Label

ReactNode

Replaces the visible label.

key

string

Overrides the React key used for the option.

* An asterisk denotes that a property is required.

Common props

These are the props most commonly used with this component. See its exported types in @payloadcms/ui for the complete list.

Prop

Type

Default

Description

pills *

SelectablePill[]

Options displayed by the selector.

onClick

({ pill }) => Promise<void> | void

Called when an option is activated.

draggable

{ onDragEnd: ({ moveFromIndex, moveToIndex }) => void }

Enables reordering and handles the result.

* An asterisk denotes that a prop is required.

Was this page helpful?

Next

Popup