BNA

BNA UI
24

A themed icon component with support for Lucide React Native icons.

Installation

pnpm dlx bna-ui add icon

Usage

import { Icon } from '@/components/ui/icon';
import { Heart, Star, Home } from 'lucide-react-native';
<Icon name={Heart} size={24} />
<Icon name={Star} color="#FFD700" />
<Icon name={Home} lightColor="#000" darkColor="#fff" />

Examples

Default

Sizes

Colors

Stroke Weights

Interactive Icons

Icon Grid

Themed Icons

API Reference

Icon

The main icon component that renders Lucide React Native icons with theming support.

PropTypeDefaultDescription
nameReact.ComponentType<LucideProps>-The Lucide icon component to render.
sizenumber24The size of the icon in pixels.
colorstring-Custom color for the icon.
lightColorstring-Color to use in light theme.
darkColorstring-Color to use in dark theme.
strokeWidthnumber1.8The stroke width of the icon.
...restLucideProps-Additional props passed to the Lucide icon component.

LucideProps

The Icon component accepts all props from Lucide React Native icons:

PropTypeDefaultDescription
strokeLinecapstringroundThe line cap style for strokes.
strokeLinejoinstring-The line join style for strokes.
fillstring-Fill color for the icon.
fillOpacitynumber-Opacity of the fill color.
strokeOpacitynumber-Opacity of the stroke color.

Accessibility

The Icon component is built with accessibility in mind:

  • Icons are decorative by default and hidden from screen readers
  • When icons convey important information, wrap them with accessible text
  • Proper color contrast for themed icons
  • Supports dynamic text sizing through size prop

Common Icon Patterns

With Labels

import { Text } from '@/components/ui/text';
import { View } from '@/components/ui/view';
 
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>
  <Icon name={Heart} size={16} />
  <Text>Favorites</Text>
</View>;

As Buttons

import { Pressable } from 'react-native';
 
<Pressable onPress={handlePress}>
  <Icon name={Settings} size={24} />
</Pressable>;
<View style={{ flexDirection: 'row', justifyContent: 'space-around' }}>
  <Icon name={Home} />
  <Icon name={Search} />
  <Icon name={Bell} />
  <Icon name={User} />
</View>