- 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 responsive grid of AI provider cards, from the host's entries or a sample, that calls back with the provider key a card selects.
Installation#
pnpm dlx shadcn@latest add @zui/ai-provider-pickerThe CLI writes components/data-entry/ai-provider-picker.tsx, installs
AI provider card, Card, Utils
and the brand mark lib, and adds @zeroxsolutions/icons, whose brand-mark-url and ai-provider-mappings entries
name each provider's mark and where the CDN serves it, and expo-image, which draws it.
Usage#
import { AiProviderPicker } from '@/components/data-entry/ai-provider-picker';With no entries, the picker shows its sample providers. Every card is a button that calls onSelect with its
entry's provider key:
<AiProviderPicker onSelect={(provider) => setProvider(provider)} />The brand mark lib, @/lib/brand-mark, also draws a mark on its own: BrandMark by a brand's name and
AiProviderIcon by a provider's key.
<AiProviderIcon provider="openai" type="avatar" size={32} />API reference#
AiProviderPicker#
Takes every prop of React Native's View, plus:
| Prop | Type | Default |
|---|---|---|
entries | readonly AiProviderPickerEntry[] | AI_PROVIDER_PICKER_SAMPLE_ENTRIES |
onSelect | (provider: string) => void | - |
The cards sit in one column, two from the sm width and three from lg, each as tall as the tallest in its row.
AiProviderPickerEntry#
One card's data.
| Field | Type | Holds |
|---|---|---|
provider | string | the key AiProviderIcon resolves, such as openai |
name | string | the card's title |
description | string | the text under the title, clamped to two lines |
meta | string, optional | the muted footer note, such as 12 models; omitted, no footer |
AI_PROVIDER_PICKER_SAMPLE_ENTRIES#
The sample entries the picker shows with no entries: providers the @zeroxsolutions/icons brand set has a mark
for, with names, blurbs and model counts only.
BrandMark#
| Prop | Type | Default |
|---|---|---|
name | BrandMarkName | - |
variant | 'color' | 'mono' | 'avatar' | 'combine' | 'color' |
size | number, the height in pixels | 16 |
label | string | - |
base | string | the CDN |
shape | 'circle' | 'square', for avatar | 'circle' |
A variant the mark has no file for, or one whose file fails to load, falls to the next along combine/avatar to
color to mono, and past mono to the name's first letter on a tinted circle. With a label the mark is an
image named by it; without one a screen reader skips it.
AiProviderIcon#
Takes provider, the key, matched without regard to case, and type, size (default 24), shape and label,
which it hands to BrandMark. A key that resolves to no mark draws a sparkle.
Differences from the web#
- The web paints
monoandcombinein the text colour through a CSS mask, which React Native lacks; expo-image tints them the foreground colour instead. - The web's ambient style provider and
setBrandMarkBaseare not ported: the picker names its variant, and a mark takes its ownbase. AiProviderIcontakes noextramappings, and neither part takes aclassNameor astyle.sizeis a number of pixels; the web's also takes a CSS length, andBrandMark's defaults to1em.- A key the CDN serves no mark for draws the letter, as on the web, without a request where the manifest lists no file.
- A row of views stands in for the web's grid, so a
classNameadds to the row's classes rather than replacing a column step. - The web's
data-slotattributes are not set; a View takes no data attributes.