Badge
The TkBadge component allows you to create a small badge for adding information like contextual data that needs to stand out and get noticed. It is also often useful in combination with other elements like a user avatar to show a number of new messages.
- React
- Vue
- Angular
import { TkBadge } from '@takeoff-ui/react'
import { TkBadge } from '@takeoff-ui/vue'
import { TkBadge } from '@takeoff-ui/angular'
Variant​
The variant of the badge for styling.
- React
- Vue
- Angular
<TkBadge variant="primary" label="primary" />
<TkBadge variant="secondary" label="secondary" />
<TkBadge variant="neutral" label="neutral" />
<TkBadge variant="info" label="info" />
<TkBadge variant="warning" label="warning" />
<TkBadge variant="success" label="success" />
<TkBadge variant="danger" label="danger" />
<TkBadge variant="verified" label="verified" />
<TkBadge variant="purple" label="purple" />
<TkBadge variant="cyan" label="cyan" />
<TkBadge variant="business" label="business" />
<TkBadge variant="primary" label="primary" />
<TkBadge variant="secondary" label="secondary" />
<TkBadge variant="neutral" label="neutral" />
<TkBadge variant="info" label="info" />
<TkBadge variant="warning" label="warning" />
<TkBadge variant="success" label="success" />
<TkBadge variant="danger" label="danger" />
<TkBadge variant="verified" label="verified" />
<TkBadge variant="purple" label="purple" />
<TkBadge variant="cyan" label="cyan" />
<TkBadge variant="business" label="business" />
<tk-badge variant="primary" label="primary" />
<tk-badge variant="secondary" label="secondary" />
<tk-badge variant="neutral" label="neutral" />
<tk-badge variant="info" label="info" />
<tk-badge variant="warning" label="warning" />
<tk-badge variant="success" label="success" />
<tk-badge variant="danger" label="danger" />
<tk-badge variant="verified" label="verified" />
<tk-badge variant="purple" label="purple" />
<tk-badge variant="cyan" label="cyan" />
<tk-badge variant="business" label="business" />
Type​
This prop specifies the design type of the component. "filled", "filledlight", "outlined", "text" designs are available
- React
- Vue
- Angular
<TkBadge variant="primary" type="filled" label="primary" />
<TkBadge variant="primary" type="filledlight" label="primary" />
<TkBadge variant="primary" type="outlined" label="primary" />
<TkBadge variant="primary" type="text" label="primary" />
<TkBadge variant="primary" type="filled" label="primary" />
<TkBadge variant="primary" type="filledlight" label="primary" />
<TkBadge variant="primary" type="outlined" label="primary" />
<TkBadge variant="primary" type="text" label="primary" />
<tk-badge variant="primary" type="filled" label="primary" />
<tk-badge variant="primary" type="filledlight" label="primary" />
<tk-badge variant="primary" type="outlined" label="primary" />
<tk-badge variant="primary" type="text" label="primary" />
Size​
The "size" prop can be used with one of the sizes "small", "base", and "large". The default value is "base"
- React
- Vue
- Angular
<TkBadge variant="primary" size="large" type="filledlight" label="primary" />
<TkBadge variant="primary" size="base" type="filledlight" label="primary" />
<TkBadge variant="primary" size="small" type="filledlight" label="primary" />
<TkBadge variant="primary" size="large" type="filledlight" label="primary" />
<TkBadge variant="primary" size="base" type="filledlight" label="primary" />
<TkBadge variant="primary" size="small" type="filledlight" label="primary" />
<tk-badge variant="primary" size="large" type="filledlight" label="primary" />
<tk-badge variant="primary" size="base" type="filledlight" label="primary" />
<tk-badge variant="primary" size="small" type="filledlight" label="primary" />
Icon​
It can be used with icons. You can also specify the icon direction. You should use Material Symbols icons.
- React
- Vue
- Angular
<TkBadge
variant="primary"
size="large"
type="filled"
icon="flight"
label="primary"
/>
<TkBadge
variant="primary"
size="large"
type="filled"
icon="flight"
iconPosition="right"
label="primary"
/>
<TkBadge
variant="primary"
size="large"
type="filled"
icon={
{
left: { name: 'key', color: 'pink' } as IIconOptions,
right: { name: 'check_circle', color: 'pink', fill: true } as IIconOptions,
} as IMultiIconOptions
}
label="primary"
/>
<TkBadge
variant="primary"
size="large"
type="filled"
icon="flight"
label="primary"
/>
<TkBadge
variant="primary"
size="large"
type="filled"
icon="flight"
iconPosition="right"
label="primary"
/>
<TkBadge
variant="primary"
size="large"
type="filled"
:icon={
{
left: { name: 'key', color: 'pink' } as IIconOptions,
right: { name: 'check_circle', color: 'pink', fill: true } as IIconOptions,
} as IMultiIconOptions
}
label="primary"
/>
<tk-badge
variant="primary"
size="large"
type="filled"
icon="flight"
label="primary"
/>
<tk-badge
variant="primary"
size="large"
type="filled"
icon="flight"
iconPosition="right"
label="primary"
/>
<tk-badge
variant="primary"
size="large"
type="filled"
icon={
{
left: { name: 'key', color: 'pink' } as IIconOptions,
right: { name: 'check_circle', color: 'pink', fill: true } as IIconOptions,
} as IMultiIconOptions
}
label="primary"
/>
Count​
The count
property can be used in more compact cases where only numbers will be shown.
- React
- Vue
- Angular
<TkBadge variant="purple" size="large" type="filledlight" count="11" rounded />
<TkBadge variant="purple" size="base" type="filledlight" count="11" rounded />
<TkBadge variant="purple" size="small" type="filledlight" count="11" rounded />
<TkBadge variant="purple" size="large" type="filledlight" count="11" rounded />
<TkBadge variant="purple" size="base" type="filledlight" count="11" rounded />
<TkBadge variant="purple" size="small" type="filledlight" count="11" rounded />
<tk-badge variant="purple" size="large" type="filledlight" count="11" rounded />
<tk-badge variant="purple" size="base" type="filledlight" count="11" rounded />
<tk-badge variant="purple" size="small" type="filledlight" count="11" rounded />
Floating​
You can use slot for floating mode
- React
- Vue
- Angular
<TkBadge variant="danger" type="filled" dot>
<div
style={{ width: "24px", height: "24px", background: "lightgrey" }}
></div>
</TkBadge>
<TkBadge variant="secondary" size="small" type="filled" count="4" rounded>
<div
style={{ width: "24px", height: "24px", background: "lightgrey" }}
></div>
</TkBadge>
<TkBadge variant="danger" type="filled" dot>
<div style="width: 24px; height: 24px; background-color: lightgray">
</div>
</TkBadge>
<TkBadge variant="secondary" size="small" type="filled" count="4" rounded>
<div style="width: 24px; height: 24px; background-color: lightgray">
</div>
</TkBadge>
<tk-badge variant="danger" type="filled" dot>
<div
style="width: 24px; height: 24px; background: lightgrey"
></div>
</tk-badge>
<tk-badge variant="secondary" size="small" type="filled" count="4" rounded>
<div
style="width: 24px; height: 24px; background: lightgrey"
></div>
</tk-badge>
API​
Props​
Name | Type | Default | Description |
---|---|---|---|
number, string | null | Defines the number for the element. | |
boolean | false | If true, shows a small dot on the badge. | |
IIconOptions, IMultiIconOptions, string | null | Specifies a material icon name to be displayed. | |
"left", "right" | 'left' | Defines the position of the icon. | |
string | null | Defines the label for the element. | |
boolean | false | Makes the badge corners rounded. | |
"base", "large", "small" | 'base' | Sets size for the component. | |
"filled", "filledlight", "outlined", "text" | 'filled' | This field specifies the design type of the component. | |
"business", "cyan", "danger", "info", "neutral", "primary", "purple", "secondary", "success", "verified", "warning" | 'primary' | Determines the badge's variant for different styles. |