Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

Components / Inputs

TransferList

Move items between two lists, e.g. which products earn stamps.

import { TransferList } from "@stylhero/ui";

Example

Code
import { TransferList } from "@stylhero/ui";

function TransferListExample() {
  return (
    <TransferList titles={["Available", "In your build"]} defaultValue={["ssd"]}
      items={[{ value: "cpu", label: "CPU" }, { value: "gpu", label: "GPU" }, { value: "ssd", label: "SSD" }, { value: "psu", label: "Power supply" }]} />
  );
}

Props

PropTypeDefaultDescription
items required TransferItem[] - Every item; the ones in value show on the right.
defaultValue string[] []
onValueChange (value: string[]) => void -
titles [ReactNode, ReactNode] ["Available", "Chosen"]
value string[] -

Also takes every <div> attribute (id, style, data-*, aria-*, event handlers…), passed to that element.

Types

type TransferItem = { value: string; label: ReactNode };

Keyboard

KeyDoes
SpaceChecks an item
TabMoves to the buttons that move checked items across

Accessibility

  • Each list and button is labelled, e.g. "Move selected right".

Generated from src/components/TransferList.tsx. Something wrong or missing? Open an issue.