One Logo Pool Ball
wwwwwwwwwwwwwwwwwww

Icons

Shared icon selection with responsive native colors

One.UI.Icon on iOS and Android: SF Symbols and Material Symbols in each color role

One.UI.Icon picks the icon element your app provides for the current platform and colors it with a native system color.

Usage

Pass one element per platform. An icon without an accessibility label is treated as decoration.

import { One } from 'one'
const shareIcons = {
ios: (
<One.iOS.Image
systemName="square.and.arrow.up"
accessibilityLabel="Share"
swiftStyle={{ fontSize: 20 }}
/>
),
android: <One.Android.Icon name="share" size={20} accessibilityLabel="Share" />,
web: <ShareIcon color="$color" size={20} />,
}
<One.UI.Icon icons={shareIcons} colorRole="accent" />
<One.UI.Icon icons={shareIcons} color="#E5484D" />

API reference

PropsTypeDescription
icons (required)IconElementsThe element for each platform. See below.
IconElementsThe element for each platform. See below.
colorRoleIconColorRole = "primary"A native system color. Cannot be set with color.
IconColorRole = "primary"A native system color. Cannot be set with color.
colorColorValueA fixed color, including an iOS dynamic color. Cannot be set with colorRole.
ColorValueA fixed color, including an iOS dynamic color. Cannot be set with colorRole.
IconElementsTypeDescription
iosReactElement<ImageProps>A One.iOS.Image element. Anything else throws on iOS.
ReactElement<ImageProps>A One.iOS.Image element. Anything else throws on iOS.
androidReactElement<ComposeIconProps>A One.Android.Icon element. Anything else throws on Android.
ReactElement<ComposeIconProps>A One.Android.Icon element. Anything else throws on Android.
webReactElementReturned unchanged on web. Without it, web renders nothing.
ReactElementReturned unchanged on web. Without it, web renders nothing.

IconColorRole is "primary" | "secondary" | "tertiary" | "accent" | "danger".

Behavior

iOSAndroidWeb
ElementOne.iOS.ImageOne.Android.Iconicons.web
GlyphsSF SymbolsMaterial SymbolsYour own
colorRoleSwiftUI system colorMaterial color schemeIgnored

Edit this page on GitHub.