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.
sizeTagSizefalse'default'Tag Size variable.
typeTagTypefalse'default'Tag type.
warning
To have appearance for 'ghost', with custom color you should use hex colors.
radiusTagRadiusfalse'medium'Tag border radius.
colorTagColorfalsetheme.color.defaultColor by theme or a custom color according react-native ColorValue.

BorderWidth

One of 'none' | 'hairline' | 'thin' | 'base' | 'thick' | number

NameTypeValue
nonenumber0
hairlineStyleSheet.hairlineWidthThis is defined as the width of a thin line on the platform. It can be used as the thickness of a border or division between two elements.
thinnumber1
basenumber2
thicknumber3
numberAny number value

TagSize

One of 'small' | 'default' | 'medium' | 'large'

NameTypeValue
smallstringText size: FONT_SIZE.small
Action width: FONT_SIZE.small * 1.18
Padding Vertical: FONT_SIZE.small
Padding Horizontal: BASE_SIZE * 0.75
Padding Vertical: BASE_SIZE * 0.25
defaultstringText size: FONT_SIZE.default
Action width: FONT_SIZE.default * 1.18
Padding Vertical: FONT_SIZE.default
Padding Horizontal: BASE_SIZE * 0.75
Padding Vertical: BASE_SIZE * 0.25
mediumstringText size: FONT_SIZE.medium
Action width: FONT_SIZE.medium * 1.18
Padding Vertical: FONT_SIZE.medium
Padding Horizontal: BASE_SIZE * 0.75
Padding Vertical: BASE_SIZE * 0.25
largestringText size: FONT_SIZE.large
Action width: FONT_SIZE.large * 1.18
Padding Vertical: FONT_SIZE.large
Padding Horizontal: BASE_SIZE * 0.75
Padding Vertical: BASE_SIZE * 0.25

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.

TagRadius

One of 'none' | 'small' | 'medium' | 'large' | 'full' | number

NameTypeValue
nonenumber0
smallnumber2
mediumnumber4
largenumber6
fullnumber99999
numberAny number value.

TagColor

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

Name Type ValuePreview
LightDark
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
ColorValueAny ColorValue chosen by developer.

Usecase 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...