Skip to main content

Tag - label component

Effect demonstration

1. Default effect of large, medium and small labels

<Flex justifyContent="space-around">
<Tag size="small">magenta</Tag>
<Tag>magenta</Tag>
<Tag size="large">magenta</Tag>
</Flex>

2. Customize background color

<Flex justifyContent="space-between">
<Tag backgroundColor="func200" text="tag" />
<Tag backgroundColor="func300" text="tag" />
<Tag backgroundColor="func500" text="small tag tag" />
</Flex>

3. Customize text color

<Flex justifyContent="space-between">
<Tag color="func200" text="tag" />
<Tag color="func300" text="tag" />
<Tag color="func500" text="tag" />
</Flex>

4. Hollow label

<Flex justifyContent="space-between">
<Tag backgroundColor="func200" text="Label" />
<Tag backgroundColor="func300" ghost text="Label" />
<Tag backgroundColor="func500" ghost text="Label" />
</Flex>

5. Disabled Effect

<Flex justifyContent="space-between">
<Tag disabled text="Label" />
<Tag backgroundColor="func300" disabled text="tag" />
<Tag backgroundColor="func500" disabled text="tag" />
</Flex>

6. Select the effect

<Flex justifyContent="space-between">
<Tag selected text="tag" />
<Tag backgroundColor="func300" selected text="tag" />
<Tag backgroundColor="func500" selected text="tag" />
</Flex>

7. Deleteable effects

<Flex justifyContent="space-between">
<Tag closable text="tag" onClose={() => Alert.alert("Close")} />
<Tag backgroundColor="func300" closable text="tag" />
<Tag backgroundColor="func500" closable text="tag" />
</Flex>

API

PropertiesRequiredDescriptionTypeDefault Value
sizefalseThe size of the labellarge| small | middlemiddle
textfalseSpecify label textstring
ghostfalseWhether the background is hollowbooleanfalse
disabledfalseSet disabledbooleanfalse
closablefalseWhether it can be closedbooleanfalse
selectablefalseWhether selectablebooleanfalse
selectedfalseSet the selected status of the labelbooleanfalse
onClosefalseClick to close callback function() => void
onSelectfalseCallback function for clicking the label(selected: boolean) => void
activeOpacityfalseOpacity when pressednumber0.6