Dark Light
System
Default LBBW Jira Confluence Source Code
Share
Playground

Tag

<afp-tag> Since 1.0.0 stable This component uses the light DOM, so its markup and styles are part of the regular document flow.

A tag component to display a label or keyword, optionally with a close icon.

Tag

Examples #

Variants #

Use the variant attribute to set the tag's semantic variant.

Neutral Brand Accent Info Error Success Warning

Appearance #

Use the appearance attribute to set the tag's visual appearance.

Default Filled Outlined Outlined filled Plain
Default Filled Outlined Outlined filled Plain
Default Filled Outlined Outlined filled Plain
Default Filled Outlined Outlined filled Plain
Default Filled Outlined Outlined filled Plain
Default Filled Outlined Outlined filled Plain
Default Filled Outlined Outlined filled Plain

Sizes #

Use the size attribute to change a tags's size.

Small Medium Large

Shapes #

Use the shape attribute to change a tag's shape.

Pill Rounded Soft Square

Closeable #

Use the closeable attribute to close the tag.

Closeable

Custom Icons #

You can provide a custom icon for the close button by using the close-icon slot.

Custom Icon

Properties

Learn more about properties.

Name Description Reflects
variant
variant of tag
Type
AfpVariant
Name Description
NEUTRAL
The main call-to-action.
BRAND
Less prominent than primary.
ACCENT
Secondary highlight for emphasis.
ERROR
Used for destructive or critical actions.
INFO
Conveys general information.
SUCCESS
Indicates a successful or positive action.
WARNING
Communicates cautionary actions.
AfpVariant
Default AfpVariant.NEUTRAL
size
size of tag
Type
AfpSize
Name Description
SMALL
Small size with compact dimensions.
MEDIUM
Medium size with standard dimensions.
LARGE
Large size with expanded dimensions.
AfpSize
Default AfpSize.MEDIUM
shape
shape of the tag
Type
AfpShape
Name Description
PILL
Makes the component circular.
ROUNDED
Makes the component rounded.
SOFT
Makes the component have soft edges.
SQUARE
Makes the component square.
AfpShape
Default AfpShape.SOFT
appearance
appearance of tag
Type
AfpAppearance
Name Description
DEFAULT
Highlighted, primary action (default).
OUTLINED
Transparent background with a visible border.
PLAIN
Minimal, no border or background.
FILLED
Solid background, no border.
OUTLINED_FILLED
Solid background with a visible border.
AfpAppearance
Default AfpAppearance.DEFAULT
closeable
Determines whether the tag element is closeable.
Type boolean
Default false
value
the value of the tag
Type string

Methods

Learn more about using methods.

Name Description Arguments
close
Closes the component and emits a close event. This method triggers the `afp-hide` event, passing the current value as an argument. The event signals that the component is being closed.
Return void
-

Events

Learn more about events.

Name Return Description
afp-show void
Emitted when the tag becomes visible.
afp-hide void
Emitted when the tag is hidden.

Slots

Learn more about slots.

Name Description
close-icon
Optional slot to replace the default close icon.
default
The default slot for the tag.

Internationalization

Learn more about internationalization.

Key Description
tag.close.aria-label
The aria-label of the close icon in the tag component.

CSS Parts

Learn more about CSS Parts.

Name Description Selector
base
The component's base wrapper.
::part(base)
label
The tag label part.
::part(label)
close-icon
The close icon part.
::part(close-icon)
close-icon-wrapper
The close icon wrapper part.
::part(close-icon-wrapper)

Dependencies

The component automatically brings in the listed items, including any nested dependencies that may exist.

afp-icon

Importing

Using the bundle is the recommended method to include components. If you’d rather handle imports manually, you can use the code examples below.

import '@afp-design-system/core/dist/components/tag/tag.js';
Share
Create a link with a predefined theme that is automatically applied when the generated link is opened. Default LBBW Presentation Mode
Abort Copy Link