Skip to main content

Tags

The FlexNative Tags is part of the FlexNative and is available under the @flexnative/tags NPM package.

Dependencies

Installation

You can installing FlexNative Tags packages using npm:

npm i @flexnative/tags

API

import Tag from '@flexnative/tags';

Component

Tag

Type: React.PureComponent<TagProps>

Properties

INFO

TagProps props extends ViewProps from react-native

NameTypeRequiredDefault ValueDescription
textstringtrueundefinedText to display on tag.
textColorColorValuefalsetheme.color.defaultText Color.
backgroundColorColorValuefalsetheme.color.defaultBackground Color.
childrenReactNodefalseundefinedReactNode to render custom react element.
borderWidthBorderWidthfalse'none'Optional borders width.
borderColorColorValuefalseundefinedBorders color according react-native ColorValue.
onDelete(event: React.BaseSyntheticEvent) => voidfalseundefinedIf provided, will render a Delete icon button, which will call this callback on press.
sizeSizesfalse'default'Tag Size variable.
typeTagTypefalse'default'Tag type.
warning
To have appearance for 'ghost', with custom color you should use hex colors.
radiusBorderRadiusfalse'medium'Tag border radius.
colorColorfalsetheme.color.defaultColor by theme or a custom color according react-native ColorValue.

TagType

One of 'default' | 'text' | 'ghost'

NameTypeDescription
defaultstringProperty to fill in solid mode the background color of the Tag component.
ghoststringProperty to fill the background with a transparent color the Tag component.
textstringProperty to fill the background with a transparent color.

Color

One of 'default' | 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error' | 'dark' | 'light' | ColorValue

Name Type ValuePreview
LightDark
whiteColorValuetheme.colors.white #FFFFFF #FFFFFF
blackColorValuetheme.colors.black #424242 #424242
backgroundColorValuetheme.colors.background #f8f8f8 #000000
defaultColorValuetheme.colors.default #f5f5f5 #404040
cardColorValuetheme.colors.card #ffffff #232323
textColorValuetheme.colors.text #424242 #ffffff
borderColorValuetheme.colors.border #42424226 #ffffff1A
placeholderColorValuetheme.colors.placeholder #0000001A #FFFFFF1A
infoColorValuetheme.colors.info #3e80ed #3e80ed
successColorValuetheme.colors.success #5ec232 #5ec232
warningColorValuetheme.colors.warning #ffc107 #ffc107
errorColorValuetheme.colors.error #d51923 #d51923
darkColorValuetheme.colors.dark #424242 #424242
secondaryColorValuetheme.colors.secondary #666666 #5C5C5C
lightColorValuetheme.colors.light #ebebeb #ebebeb
primaryColorValuetheme.colors.primary #ff6358 #ff6358
overlayColorValuetheme.colors.overlay #00000021 #FFFFFF21
ColorValueAny ColorValue chosen by developer.

Use case Examples

The following example demonstrates the FlexNative Tags in action.

Colors

primary
secondary
success
info
warning
error
default
dark
light
crimson
#ed143d
rgb(237, 20, 61)
rgba(237, 20, 61, 0.5)

Background Color

crimson
#ed143d
rgb(237, 20, 61)
rgba(237, 20, 61, 0.5)

Border Color

crimson
#ed143d
rgb(237, 20, 61)
rgba(237, 20, 61, 0.5)

Border Width

none (default)
hairline
thin
base
thick
2

Children

Custom Children Render

Size

small
default
medium
large

OnDelete

small
default
medium
large

Border Radius

none
small
medium (default)
large
full
5

Text Color

crimson
#ed143d
rgb(237, 20, 61)
rgba(237, 20, 61, 0.5)

TextProps

TextProps

Types

default
ghost
text

Playground

Live Editor
//Play with props to see live changes;

render(<Tag color='primary' borderWidth='thin' type='ghost' text='Playground Tag Component' borderColor='#ed143d'/>);
Result
Loading...