Get started
Forms
- 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
Display
- 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
Layout
Installation#
bash
pnpm dlx shadcn@latest add @zui/aspect-ratioThe CLI writes components/ui/aspect-ratio.tsx, installs Utils, and adds @rn-primitives/aspect-ratio.
Usage#
tsx
import { Image } from 'react-native';
import { AspectRatio } from '@/components/ui/aspect-ratio';tsx
<AspectRatio ratio={16 / 9} className="overflow-hidden rounded-lg">
<Image source={{ uri: 'https://example.com/cover.jpg' }} className="size-full" />
</AspectRatio>API reference#
AspectRatio#
Takes every prop of the @rn-primitives/aspect-ratio root, plus:
| Prop | Type | Default |
|---|---|---|
ratio | number | required |
ratio is width over height. The frame is as wide as its parent lets it be, and its height follows. A child
sized size-full or absolute inset-0 fills it.
Differences from upstream#
- Upstream passes the ratio to CSS as a custom property. The native frame takes React Native's own
aspectRatiostyle, which both engines draw.