- 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
A small card for one AI provider in an overview grid, whose footer note carries a status dot and whose trigger selects it.
Installation#
pnpm dlx shadcn@latest add @zui/ai-provider-cardThe CLI writes components/data-display/ai-provider-card.tsx, installs
Card, Status indicator,
Text, Focus visible and Utils.
Usage#
import {
AiProviderCard,
AiProviderCardAction,
AiProviderCardDescription,
AiProviderCardLabel,
AiProviderCardTrigger,
} from '@/components/data-display/ai-provider-card';Compose a CardHeader holding CardTitle and an AiProviderCardDescription, a CardFooter holding the label and
the action, and a trigger as the card's direct child:
<AiProviderCard>
<CardHeader>
<CardTitle>OpenAI</CardTitle>
<AiProviderCardDescription>GPT reasoning and chat models for general-purpose assistance.</AiProviderCardDescription>
</CardHeader>
<CardFooter>
<AiProviderCardLabel tone="online">12 models</AiProviderCardLabel>
<AiProviderCardAction>
<Switch aria-label="Enable OpenAI" checked={enabled} onCheckedChange={setEnabled} />
</AiProviderCardAction>
</CardFooter>
<AiProviderCardTrigger aria-label="Select OpenAI" onPress={select} />
</AiProviderCard>Use it for a grid the person picks one provider from.
Composition#
AiProviderCard
|-- CardHeader
| |-- CardTitle
| `-- AiProviderCardDescription
|-- CardFooter
| |-- AiProviderCardLabel
| `-- AiProviderCardAction
`-- AiProviderCardTriggerAPI reference#
AiProviderCard#
Takes every prop of Card, and defaults its size to sm. Given an
AiProviderCardTrigger as a direct child, a press anywhere on the card runs the trigger's onPress, but on a
control inside an AiProviderCardAction, which takes the press itself.
AiProviderCardDescription#
Takes every prop of CardDescription: the provider blurb, on at most two lines.
AiProviderCardLabel#
Takes every prop of React Native's View, plus:
| Prop | Type | Default |
|---|---|---|
tone | 'online' | 'offline' | 'busy' | 'idle' | - |
The footer note, such as a model count or an attention message, in small muted text on one line. Given a tone,
a Status indicator before it carries the status, so the note
reads the same at any tone.
AiProviderCardAction#
Takes every prop of React Native's View: a control inside the card, such as a
Switch, which takes a press itself, so pressing it does not select the card.
AiProviderCardTrigger#
Takes every prop of React Native's Pressable. The button that selects the card, announced as a button and
covering the card under its content, so a screen reader and a keyboard reach the card as one button; give it an
aria-label naming the provider. Pressing the card draws a hairline inside its edge, and keyboard focus a wider
ring, both rounded as the card is.
Differences from the web#
onPressstands in for the web'sonClick, and pressing for hovering: the hairline the web draws while the card is hovered shows while it is pressed.- The trigger lies under the card's content, and the card around it takes a press on the content; the web lays the trigger over the content and lifts the action above it, which a view cannot, since it stacks above its siblings only.
- The trigger's inset rings are drawn as borders, which a view draws inside its box as the web's inset ring is.
- The web's
data-slotattributes are not set; a View takes no data attributes.