apps/docs/content/docs/en/native/components/(data-display)/chip.mdx
<NativeVideoPlayerView target="auto" srcLight="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/native/components/videos/chip-docs-light.mp4" srcDark="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/native/components/videos/chip-docs-dark.mp4" />
import { Chip } from 'heroui-native';
<Chip>
<Chip.Label>...</Chip.Label>
</Chip>
secondary variant, and for the primary/soft variants with color="default", when the active theme registers default background content (e.g. glass). Replace or remove it via the background prop.The Chip component displays text or custom content in a capsule shape.
<Chip>Basic Chip</Chip>
Control the chip size with the size prop.
<Chip size="sm">Small</Chip>
<Chip size="md">Medium</Chip>
<Chip size="lg">Large</Chip>
Choose between different visual styles with the variant prop.
<Chip variant="primary">Primary</Chip>
<Chip variant="secondary">Secondary</Chip>
<Chip variant="tertiary">Tertiary</Chip>
<Chip variant="soft">Soft</Chip>
Apply different color themes with the color prop.
<Chip color="accent">Accent</Chip>
<Chip color="default">Default</Chip>
<Chip color="success">Success</Chip>
<Chip color="warning">Warning</Chip>
<Chip color="danger">Danger</Chip>
Add icons or custom content alongside text using compound components.
<Chip>
<Icon name="star" size={12} />
<Chip.Label>Featured</Chip.Label>
</Chip>
<Chip>
<Chip.Label>Close</Chip.Label>
<Icon name="close" size={12} />
</Chip>
Apply custom styles using className or style props.
<Chip className="bg-purple-600 px-6">
<Chip.Label className="text-white">Custom</Chip.Label>
</Chip>
Disable all animations including children by using the "disable-all" value for the animation prop.
{
/* Disable all animations including children */
}
<Chip animation="disable-all">No Animations</Chip>;
import { Chip } from 'heroui-native';
import { View, Text } from 'react-native';
import { Ionicons } from '@expo/vector-icons';
export default function ChipExample() {
return (
<View className="gap-4 p-4">
<View className="flex-row flex-wrap gap-2">
<Chip size="sm">Small</Chip>
<Chip size="md">Medium</Chip>
<Chip size="lg">Large</Chip>
</View>
<View className="flex-row flex-wrap gap-2">
<Chip variant="primary" color="accent">
Primary
</Chip>
<Chip variant="secondary" color="success">
<View className="size-1.5 rounded-full bg-success" />
<Chip.Label>Success</Chip.Label>
</Chip>
<Chip variant="tertiary" color="warning">
<Ionicons name="star" size={12} color="#F59E0B" />
<Chip.Label>Premium</Chip.Label>
</Chip>
</View>
<View className="flex-row gap-2">
<Chip variant="secondary">
<Chip.Label>Remove</Chip.Label>
<Ionicons name="close" size={14} color="#6B7280" />
</Chip>
<Chip className="bg-purple-600">
<Chip.Label className="text-white font-semibold">Custom</Chip.Label>
</Chip>
</View>
</View>
);
}
You can find more examples in the GitHub repository.
| prop | type | default | description |
|---|---|---|---|
children | React.ReactNode | - | Content to render inside the chip |
size | 'sm' | 'md' | 'lg' | 'md' | Size of the chip |
variant | 'primary' | 'secondary' | 'tertiary' | 'soft' | 'primary' | Visual variant of the chip |
color | 'accent' | 'default' | 'success' | 'warning' | 'danger' | 'accent' | Color theme of the chip |
className | string | - | Additional CSS classes to apply |
animation | "disable-all" | undefined | undefined | Animation configuration. Use "disable-all" to disable all animations including children |
background | React.ReactNode | - | Background layer behind the chip surface. undefined renders the theme-aware default for the secondary variant and the primary/soft variants with color="default"; custom node replaces it; null removes it |
...PressableProps | PressableProps | - | All Pressable props are supported |
Absolute-fill container rendered behind the chip surface. With no children, the active library theme decides the default content (e.g. a glass blur layer); pass children to host custom content with the same positioning and clipping.
| prop | type | default | description |
|---|---|---|---|
children | React.ReactNode | - | Custom content inside the background container |
className | string | - | Additional CSS classes |
...ViewProps | ViewProps | - | All standard View props are supported |
| prop | type | default | description |
|---|---|---|---|
children | React.ReactNode | - | Text or content to render as the label |
className | string | - | Additional CSS classes to apply |
...TextProps | TextProps | - | All standard Text props are supported |
Hook to access the Chip context values. Returns the chip's size, variant, and color.
import { useChip } from 'heroui-native';
const { size, variant, color } = useChip();
| property | type | description |
|---|---|---|
size | 'sm' | 'md' | 'lg' | Size of the chip |
variant | 'primary' | 'secondary' | 'tertiary' | 'soft' | Visual variant of the chip |
color | 'accent' | 'default' | 'success' | 'warning' | 'danger' | Color theme of the chip |
Note: This hook must be used within a Chip component. It will throw an error if called outside of the chip context.