HQReact UI
DocsThemes
  • Getting Started
  • Introduction
  • Installation
  • Client Side Routing
  • MCP Server
  • LLMs
  • Framework Guides
  • Nextjs
  • Laravel
  • Vite
  • Tanstack Start
  • Components
  • Buttons
  • Button
  • File Trigger
  • Toggle
  • Charts
  • Chart
  • Collections
  • Accordion
  • Bubble
  • Collapsible
  • Context Menu
  • Dropdown Menu
  • Grid List
  • Item
  • List Box
  • Message
  • Table
  • Tag Group
  • Tree
  • Colors
  • Color
  • Controls
  • Command
  • Kbd
  • Slider
  • Switch
  • Toolbar
  • Date And Time
  • Calendar
  • Range Calendar
  • Date Field
  • Date Picker
  • Date Range Picker
  • Time Field
  • Drag And Drop
  • Drop Zone
  • Forms
  • Field
  • Input
  • Combobox
  • Input Group
  • Checkbox
  • Radio
  • Select
  • Text Field
  • Number Field
  • Search Field
  • Input OTP
  • Layouts
  • Container
  • Navbar
  • Sidebar
  • Media
  • Avatar
  • Carousel
  • Navigation
  • Link
  • Breadcrumbs
  • Tabs
  • Pagination
  • Overlays
  • Dialog
  • Alert Dialog
  • Sheet
  • Popover
  • Tooltip
  • Statuses
  • Alert
  • Badge
  • Empty
  • Meter
  • Progress
  • Skeleton
  • Toastalpha
  • Surfaces
  • Card
  • Separator

On this page

List Box

ListBox

Installation

CLI
Manual

npx shadcn add https://hq-ui.vercel.app/r/list-box

Examples

Multiple selection

To enable multiple selections, set the selectionMode prop to multiple. This prop has no default value, so it must be explicitly defined.

list-box-multiple-demo
Apple
Banana
Orange
Strawberry
Grapes
Mango
Pineapple

Selected: 3

Description

You can enhance list items by providing additional details using the Listbox.Description component.

list-box-description-demo
AdminHas full access to all resources
EditorCan edit content but has limited access to settings
ViewerCan view content but cannot make changes
ContributorCan contribute content for review
GuestLimited access, mostly for viewing purposes

Section

Group items in a ListBox using sections for better organization.

list-box-section-demo
The Beatles
Abbey Road
Sgt. Pepper's Lonely Hearts Club Band
Revolver
Led Zeppelin
Led Zeppelin IV
Physical Graffiti
Houses of the Holy
Led Zeppelin II
Pink Floyd
The Dark Side of the Moon
The Wall
Wish You Were Here
Animals
Meddle
Queen
A Night at the Opera
News of the World
Sheer Heart Attack
The Game
Jazz
Queen II
The Rolling Stones
Let It Bleed
Sticky Fingers
Exile on Main St.
Beggars Banquet
Some Girls
Tattoo You
Nirvana
Nevermind
In Utero
Bleach
The Doors
The Doors
L.A. Woman
Strange Days
Morrison Hotel
Radiohead
OK Computer
Kid A
The Bends
In Rainbows
AC/DC
Back in Black
Highway to Hell
Let There Be Rock
The Who
Who's Next
Tommy
Quadrophenia
My Generation
The Who Sell Out

Drag and drop

Enable drag-and-drop functionality in the ListBox by using the dragAndDropHooks prop with the useDragAndDrop hook. This allows users to rearrange items, insert new entries, or manage data across the list.

list-box-rearrange-demo
Nirvana
Radiohead
Foo Fighters
Arctic Monkeys
The Strokes

Infinite scrolling

ListBox can handle large datasets efficiently with infinite scrolling. This allows for loading more data as the user scrolls down, improving performance and user experience.

list-box-infinite-scroll-demo
No results found

Controlled

To enable controlled mode, set the selectionMode prop to single. This allows you to manage the ListBox selection using the selectedKey prop.

list-box-controlled-demo
Apple
Banana
Orange
Strawberry
Grapes
Mango
Pineapple

Selected: 1

Disabled

Disable specific ListBox items to restrict user interaction.

list-box-disabled-demo
Apple
Banana
Orange
Strawberry
Grapes
Mango
Pineapple

You can also disable an item directly by passing the isDisabled prop to ListBoxItem.

<ListBoxItem isDisabled>Disabled</ListBoxItem>
Item
Message

On this page

  • Installation
  • Examples
  • Multiple selection
  • Description
  • Section
  • Drag and drop
  • Infinite scrolling
  • Controlled
  • Disabled