Skip to main content

Show case

The following example demonstrates the Icons in action.

Basic Icon

Use the Icon component to display a static icon. It resolves styles (color, size) from the @flexnative/icons.

IconProps

info

Inherits all other standard React Native Text component props.

PropertyTypeRequiredDefault ValueDescription
namestringtrueundefinedThe name of the icon to render. This must match a key in the icon set configuration passed to IconProvider.
sizeFontSizefalsemdSize of the icon. Values from the theme's fontSize or a numeric value.
colorColorfalseundefinedThe color of the icon. Can be a hex code, a standard color string, or a key from the theme colors.
backgroundColorColorValuefalseundefinedThe background color of the icon. Supports theme color keys or standard color values.
borderRadiusColorfalseundefinedBorder radius for the icon background. Values from the theme's borders.radius or a numeric value.
import { Icon } from '@flexnative/icons';

<Icon name="home" size="md" color="primary" />

Playground

Play with props to see live changes;

Live Editor
// Play with props to see live changes;
render(
  <Icon name='star'
        size={128}
        color='primary'
        backgroundColor='#ebedf0'
        borderRadius={64}
  />
);
Result
Loading...

Animated Icon

Use the AnimatedIcon component to display icons with built-in animations. You can switch animations using the animation prop.

AnimatedIconProps

info

Inherits all IconProps props.

PropertyTypeDescription
durationnumberThe duration of one animation cycle in milliseconds.
delaynumberDelay before the animation starts in milliseconds.
pulseColorstring(HeartbeatIcon only) The color to interpolate to during the beat.
amplitudenumber(GlitchIcon only) The intensity of the glitch displacement.

Available Animations

AnimationComponentDescription
bounceBounceIconScales the icon up and down continuously.
fadeFadeIconPulses the opacity of the icon.
glitchGlitchIconRandomly shifts the icon position and opacity to simulate a glitch effect.
heartbeatHeartbeatIconMimics a cardiac rhythm (lub-dub) using scale.
pulsePulseIconAnimates the backgroundColor opacity (breathing effect).
shakeShakeIconRotates the icon back and forth quickly.
spinSpinnerRotates the icon 360 degrees infinitely.
wiggleWiggleIconRotates the icon back and forth gently.
import { AnimatedIcon } from '@flexnative/icons';

<AnimatedIcon
name="heart"
animation="heartbeat"
size="xl"
color="error"
duration={1200}
/>

Specific Animated Components

You can also import specific animated components directly for better type safety or specific props.

import { 
BounceIcon,
FadeIcon,
GlitchIcon,
HeartbeatIcon,
PulseIcon,
ShakeIcon,
Spinner,
WiggleIcon
} from '@flexnative/icons';

<Spinner name="loading" />
<HeartbeatIcon name="heart" pulseColor="#ff0000" />
<GlitchIcon name="alert" amplitude={6} />

Playground

Play with props to see live changes;

Live Editor
// Play with props to see live changes;
render(
  <HeartbeatIcon
    name="star"
    size={128}
    color='primary'
    backgroundColor='#ebedf0'
    borderRadius={64}
    pulseColor="#ff0000"
  />
);
Result
Loading...