Skip to content

components/ReorderTabs

import { … } from 'zidane-ui'ui/src/components/ReorderTabs.tsx

Components#

ReorderTabsComponent#

Renders the reorderable tab strip (see the module comment).

TypeScript
function ReorderTabs(props: ReorderTabsProps): Element
Parameters
NameTypeDescription
propsReorderTabsProps

Component props.

Element
ReorderTabs props
NameTypeDescription
activeIdstring | null

The selected tab, scrolled into view; null when none is.

className?string

Extra classes on the strip.

idsreadonly string[]

The tabs, in their current order.

labelstring

Accessible name of the tablist.

onReorder(ids: readonly string[]) => void

The new order, once per drop or keyboard move.

renderTab(id: string, state: ReorderTabState) => ReactNode

Draws one tab (a role="tab" element); state wires its pick, lift and keyboard move.

style?CSSProperties

Inline styles on the root element, merged after the component's own.

ui/src/components/ReorderTabs.tsx:47

Interfaces#

ReorderTabsPropsInterface#

Props of ReorderTabs.

TypeScript
interface ReorderTabsProps
ReorderTabsProps properties
NameTypeDescription
activeIdstring | null

The selected tab, scrolled into view; null when none is.

className?string

Extra classes on the strip.

idsreadonly string[]

The tabs, in their current order.

labelstring

Accessible name of the tablist.

onReorder(ids: readonly string[]) => void

The new order, once per drop or keyboard move.

renderTab(id: string, state: ReorderTabState) => ReactNode

Draws one tab (a role="tab" element); state wires its pick, lift and keyboard move.

style?CSSProperties

Inline styles on the root element, merged after the component's own.

ui/src/components/ReorderTabs.tsx:25

ReorderTabStateInterface#

What a tab needs to take part in the strip.

TypeScript
interface ReorderTabState
ReorderTabState properties
NameTypeDescription
liftedboolean

Held by the pointer.

onMove(delta: number) => void

Moves the tab one slot left (-1) or right (+1).

pick(run: () => void) => () => void

Wraps the tab's pick, so the click that ends a drag doesn't pick.

ui/src/components/ReorderTabs.tsx:15