Chips
The TkChip component is basically a simple UI block entity, representing for example more advanced underlying data, such as a contact, in a compact way. Chips can contain entities such as an avatar, text or an icon, optionally having a pointer too.
- React
- Vue
- Angular
import { TkChips } from '@takeoff-ui/react'
import { TkChips } from '@takeoff-ui/vue'
import { TkChips } from '@takeoff-ui/angular'
Playground
Preview
Generated Code
<TkChips variant="primary" type="filled" size="base" label="Chip Label" iconPosition="left" autoSelfDestroy/><TkChips variant="primary" type="filled" size="base" label="Chip Label" iconPosition="left" :autoSelfDestroy.prop="true"/><tk-chips variant="primary" type="filled" size="base" label="Chip Label" iconPosition="left" [autoSelfDestroy]="true"/>Controls
Variant
The variant of the chips for styling.
- React
- Vue
- Angular
<TkChips variant="primary" label="primary" removable />
<TkChips variant="secondary" label="secondary" removable />
<TkChips variant="neutral" label="neutral" removable />
<TkChips variant="info" label="info" removable />
<TkChips variant="warning" label="warning" removable />
<TkChips variant="success" label="success" removable />
<TkChips variant="danger" label="danger" removable />
<TkChips variant="verified" label="verified" removable />
<TkChips variant="primary" label="primary" removable />
<TkChips variant="secondary" label="secondary" removable />
<TkChips variant="neutral" label="neutral" removable />
<TkChips variant="info" label="info" removable />
<TkChips variant="warning" label="warning" removable />
<TkChips variant="success" label="success" removable />
<TkChips variant="danger" label="danger" removable />
<TkChips variant="verified" label="verified" removable />
<tk-chips variant="primary" label="primary" removable />
<tk-chips variant="secondary" label="secondary" removable />
<tk-chips variant="neutral" label="neutral" removable />
<tk-chips variant="info" label="info" removable />
<tk-chips variant="warning" label="warning" removable />
<tk-chips variant="success" label="success" removable />
<tk-chips variant="danger" label="danger" removable />
<tk-chips variant="verified" label="verified" removable />
Type
This field specifies the design type of the component. "filled", "filledlight", "outlined" designs are available
- React
- Vue
- Angular
<TkChips variant="primary" type="filled" label="primary" />
<TkChips variant="primary" type="filledlight" label="primary" />
<TkChips variant="primary" type="outlined" label="primary" />
<TkChips variant="primary" type="filled" label="primary" />
<TkChips variant="primary" type="filledlight" label="primary" />
<TkChips variant="primary" type="outlined" label="primary" />
<tk-chips variant="primary" type="filled" label="primary" />
<tk-chips variant="primary" type="filledlight" label="primary" />
<tk-chips variant="primary" type="outlined" 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
<TkChips variant="primary" size="small" label="primary" removable />
<TkChips variant="primary" size="base" label="primary" removable />
<TkChips variant="primary" size="large" label="primary" removable />
<TkChips variant="primary" size="small" label="primary" removable />
<TkChips variant="primary" size="base" label="primary" removable />
<TkChips variant="primary" size="large" label="primary" removable />
<tk-chips variant="primary" size="small" label="primary" removable />
<tk-chips variant="primary" size="base" label="primary" removable />
<tk-chips variant="primary" size="large" label="primary" removable />
Icon
This example illustrates how to use an icon with chips.
String Usage - Single
Icon Options Usage - Single
String Icon Usage - Multiple
Icon Options Usage - Multiple
- React
- Vue
- Angular
<TkChips variant="primary" size="large" icon="flight" label="Left Icon" />
<TkChips variant="primary" size="large" icon="flight" label="Right Icon" iconPosition="right" />
<TkChips variant="primary" size="large" icon={{ name: 'home', color: 'red', fill: true } as IIconOptions} label="Left Icon" />
<TkChips variant="primary" size="large" icon={{ name: 'home', color: 'red', fill: true } as IIconOptions} label="Right Icon" iconPosition="right" />
<TkChips
variant="primary"
size="large"
label="Multiple Icon"
icon={
{
left: 'key',
right: 'check_circle',
} as IMultiIconOptions
}
/>
<TkChips
variant="primary"
size="large"
label="Multiple Icon"
icon={
{
left: { name: 'key', color: 'var(--blue-500)' } as IIconOptions,
right: { name: 'check_circle', color: 'var(--green-600)', fill: true } as IIconOptions,
} as IMultiIconOptions
}
/>
<TkChips variant="primary" size="large" icon="flight" label="Left Icon" />
<TkChips variant="primary" size="large" icon="flight" label="Right Icon" iconPosition="right" />
<TkChips
variant="primary"
size="large"
:icon="{ name: 'home', color: 'red', fill: true }"
label="Left Icon"
/>
<TkChips
variant="primary"
size="large"
:icon="{ name: 'home', color: 'red', fill: true }"
label="Right Icon"
iconPosition="right"
/>
<TkChips
variant="primary"
size="large"
label="Multiple Icon"
:icon="{
left: 'key',
right: 'check_circle'
}"
/>
<TkChips
variant="primary"
size="large"
label="Multiple Icon"
:icon="{
left: { name: 'key', color: 'var(--blue-500)' },
right: { name: 'check_circle', color: 'var(--green-600)', fill: true }
}"
/>
<tk-chips variant="primary" size="large" icon="flight" label="Left Icon"></tk-chips>
<tk-chips variant="primary" size="large" icon="flight" label="Right Icon" iconPosition="right"></tk-chips>
<tk-chips
variant="primary"
size="large"
[icon]="{ name: 'home', color: 'red', fill: true }"
label="Left Icon"
></tk-chips>
<tk-chips
variant="primary"
size="large"
[icon]="{ name: 'home', color: 'red', fill: true }"
label="Right Icon"
iconPosition="right"
></tk-chips>
<tk-chips
variant="primary"
size="large"
label="Multiple Icon"
[icon]="{
left: 'key',
right: 'check_circle'
}"
></tk-chips>
<tk-chips
variant="primary"
size="large"
label="Multiple Icon"
[icon]="{
left: { name: 'key', color: 'var(--blue-500)' },
right: { name: 'check_circle', color: 'var(--green-600)', fill: true }
}"
></tk-chips>
FullWidth
The fullWidth prop makes the chips component expand to the full width of its
container.
- React
- Vue
- Angular
<div className="flex gap-2">
<TkChips fullwidth label="A" />
<TkChips fullwidth label="AA" />
<TkChips fullwidth label="AAA" />
</div>
<div className="flex gap-2">
<TkChips fullwidth label="A" />
<TkChips fullwidth label="AA" />
<TkChips fullwidth label="AAA" />
</div>
<div className="flex gap-2">
<tk-chips fullwidth label="A"></tk-chips>
<tk-chips fullwidth label="AAA"></tk-chips>
<tk-chips fullwidth label="AA"></tk-chips>
</div>
API
Props
| Name | Type | Default | Description |
|---|---|---|---|
boolean | true | Determines whether the chip automatically removes itself when the close button is clicked. | |
CSSStyleProperties | null | Custom style to apply to the chip component. | |
boolean | false | The disabled status. | |
boolean | false | If true, the chip will take the full width of its container. | |
IIconOptions, IMultiIconOptions, string | null | Specifies a material icon name to be displayed. | |
"left", "right" | 'left' | The position of the icon relative to the label. | |
string | null | The label to display inside the chip. | |
boolean | false | This property determines whether the chip component is removable. | |
"base", "large", "small" | 'base' | Sets size for the component. | |
"avatar", "filled", "filledlight", "outlined" | 'filled' | This field specifies the design type of the component. | |
any | null | The value of the chips | |
"danger", "info", "neutral", "primary", "secondary", "success", "verified", "warning" | 'primary' | The variant of the chip for styling. |
Events
| Name | Description |
|---|---|
| tk-remove | When an element is deleted, it is triggered. It returns the label. |
Interfaces
IChipOptions
interface IChipOptions {
icon?: string | IIconOptions;
iconPosition?: 'left' | 'right';
type?: 'filled' | 'filledlight' | 'outlined' | 'avatar';
size?: 'large' | 'base' | 'small';
variant?:
| 'primary'
| 'secondary'
| 'neutral'
| 'info'
| 'success'
| 'danger'
| 'warning'
| 'verified';
containerStyle?: CSSStyleProperties;
}