Skip to content

Chip

Chips are compact elements that represent an input, attribute, or action. They can display icons, avatars, and delete actions.

import { Chip } from '@truongdq01/ui';
<Chip label="React Native" variant="solid" />;
PropTypeDefaultDescription
labelReactNodeRequired. Chip text content
variant"solid" | "outlined" | "subtle""solid"Visual style variant
color"default" | "primary" | "secondary" | "error" | "info" | "success" | "warning""default"Semantic color
size"sm" | "md" | "lg""md"Height and padding
avatarReactNodeAvatar element (left side)
iconReactNodeIcon element (left side)
deleteIconReactNodeCustom delete icon
onDelete() => voidCallback when delete pressed
onClick() => voidCallback when chip pressed
disabledbooleanfalseDisable interactions
clickablebooleanfalseEnable click behavior
<Chip label="Solid" variant="solid" />
<Chip label="Outlined" variant="outlined" />
<Chip label="Subtle" variant="subtle" />
<Chip label="Default" color="default" />
<Chip label="Primary" color="primary" />
<Chip label="Secondary" color="secondary" />
<Chip label="Success" color="success" />
<Chip label="Error" color="error" />
<Chip label="Info" color="info" />
<Chip label="Warning" color="warning" />
<Chip label="Small" size="sm" />
<Chip label="Medium" size="md" />
<Chip label="Large" size="lg" />
import { Avatar } from '@truongdq01/ui';
<Chip
label="John Doe"
avatar={<Avatar src="https://example.com/avatar.jpg" size="sm" />}
/>;
import { Star, Heart } from "lucide-react-native";
<Chip label="Favorite" icon={<Star size={16} />} />
<Chip label="Liked" icon={<Heart size={16} />} color="error" />
function DeletableChip() {
const [visible, setVisible] = React.useState(true);
return visible ? (
<Chip label="Dismissible" onDelete={() => setVisible(false)} />
) : null;
}
<Chip
label="Filter: Active"
clickable
onClick={() => setFilter(filter === 'active' ? 'all' : 'active')}
/>
<View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 8 }}>
<Chip label="React" size="sm" />
<Chip label="TypeScript" size="sm" />
<Chip label="React Native" size="sm" />
<Chip label="UI/UX" size="sm" />
</View>
const [activeFilter, setActiveFilter] = useState('all');
<View style={{ flexDirection: 'row', gap: 8 }}>
<Chip
label="All"
variant={activeFilter === 'all' ? 'solid' : 'outlined'}
onClick={() => setActiveFilter('all')}
/>
<Chip
label="Active"
variant={activeFilter === 'active' ? 'solid' : 'outlined'}
onClick={() => setActiveFilter('active')}
/>
<Chip
label="Completed"
variant={activeFilter === 'completed' ? 'solid' : 'outlined'}
onClick={() => setActiveFilter('completed')}
/>
</View>;
<Chip label="Online" color="success" size="sm" />
<Chip label="Away" color="warning" size="sm" />
<Chip label="Offline" color="default" size="sm" />
  • Use for tags, filters, and status indicators
  • Keep labels concise (1-3 words)
  • Use appropriate colors for semantic meaning
  • Provide delete functionality for removable items
  • Don’t use for long text (use badges or labels instead)
  • Don’t use too many chips in a row (consider wrapping)
  • Don’t mix too many colors (stick to semantic meaning)
<Chip
label="Filter applied"
accessibilityLabel="Filter: Active projects"
accessibilityHint="Double tap to remove filter"
/>
  • Badge - Simple status indicator
  • Avatar - User image for chips
  • Icon - Icons for chips
  • Button - For actions instead of chips