- Label
- Icon label
- Field
- Form
- Frontmatter form
- Questionnaire
- Input
- Input group
- Input OTP
- Password input
- Password strength
- Code input
- Number field
- Tag input
- Textarea
- Checkbox
- Radio group
- Language toggle group
- Emoji appearance toggle group
- Emoji picker
- Avatar picker
- AI provider picker
- Select
- Native select
- Combobox
- Language combobox
- Slider
- Calendar
- Switch
- Alert
- Avatar
- Badge
- Card
- AI provider card
- Model info card
- Model list
- Empty
- Item
- Tree item
- File tree
- Icon media
- File type icon
- Font preview
- Image preview
- Kbd
- Table
- Data table
- Data table column header
- Chart
- Code Block
- Code card
- Markdown view
- Attachment
- Bubble
- Marker
- Message
- Chat message
- Chat suggestion item
- Message scroller
- Trace
- Progress
- Spinner
- Sonner
- Toast
- Unsaved changes toolbar
- Unsaved indicator
- Status indicator
- Permission card
- Separator
- Skeleton
- Animated grid pattern
- Meteors
The frame for a model list section, a header over a scrolling content area, with a remove button and loading placeholders.
Installation#
pnpm dlx shadcn@latest add @zui/model-listThe CLI writes components/layout/model-list.tsx, installs Button,
Icon, Item,
Scroll area, Skeleton,
Text and Utils, and adds lucide-react-native.
Usage#
import {
ModelList,
ModelListAction,
ModelListContent,
ModelListHeader,
ModelListRemoveButton,
ModelListSkeleton,
ModelListTitle,
} from '@/components/layout/model-list';
import { Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemTitle } from '@/components/ui/item';<ModelList>
<ModelListHeader>
<ModelListTitle>Model list</ModelListTitle>
<ModelListAction>{search}</ModelListAction>
</ModelListHeader>
<ModelListContent>
<ItemGroup>
<Item size="sm" className={unavailable ? 'opacity-50' : undefined}>
<ItemContent>
<ItemTitle>GPT-4o</ItemTitle>
<ItemDescription>gpt-4o</ItemDescription>
</ItemContent>
<ItemActions>
<ModelListRemoveButton aria-label="Remove GPT-4o" onPress={remove} />
</ItemActions>
</Item>
</ItemGroup>
</ModelListContent>
</ModelList>It owns no list state: it does not filter, group, sort or paginate. Place it in a parent of bounded height so the
content scrolls. Show a ModelListSkeleton in the content while the list loads.
Two things the web's frame does from its own classes, the caller writes on the element itself here:
- an unavailable model's
Itemtakesopacity-50, as above; - a
TabsListin the header takesbasis-full, so it has a line of its own:
<ModelListHeader>
<ModelListTitle>Models</ModelListTitle>
<TabsList className="basis-full">{triggers}</TabsList>
</ModelListHeader>Composition#
ModelList
|-- ModelListHeader
| |-- ModelListTitle
| `-- ModelListAction
`-- ModelListContent
`-- ItemGroup
`-- Item
`-- ItemActions
`-- ModelListRemoveButtonAPI reference#
ModelList#
Takes every prop of a View. A column filling its parent, which must have a bounded height for the content to
scroll.
ModelListHeader#
Takes every prop of a View. A row of the title and trailing controls, wrapping onto a second line when they do not
fit.
ModelListTitle#
Takes every prop of Text. The section's heading, announced as a heading, growing to push the header's controls to its end.
ModelListAction#
Takes every prop of a View. Trailing header controls, such as a search field or a refresh button.
ModelListContent#
Takes every prop of ScrollArea. The scrolling region filling the rest of the frame; its children stack with a gap.
ModelListRemoveButton#
Takes every prop of Button. A ghost small icon button with a trash icon,
named "Remove model" unless given its own aria-label; children replace the icon.
ModelListSkeleton#
Takes every prop of a View, plus:
| Prop | Type | Default |
|---|---|---|
count | number | 6 |
Placeholder items in the shape of a model item: a media placeholder, two text lines and a trailing control.
Differences from the web#
- The web dims an
Itemmarkeddata-unavailableand stretches aTabsListacross the header through selectors that reach into its children, which React Native has no counterpart of; writeopacity-50andbasis-fullon those elements, as above. onPressstands in for the web'sonClick.- The web's
data-slotattributes are not set; a View takes no data attributes.