Badge
A small status/label pill.
fandry-badge
Example
Link to section ExampleCustom colors and parts
Link to section Custom colors and partsThe same component with a few --fd-* tokens set around it and its parts restyled. The code is under Parts below.
Props
Link to section Props| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'default' | Color variant. The colored ones are soft, not solid, so a column of badges stays quieter than the data beside it. Each derives its fill, border and text from its own color (--fd-primary, --fd-success, --fd-warning, --fd-danger) with --fd-bg, --fd-text and --fd-surface-tint, so it follows a rebrand and dark themes. |
Parts
Link to section PartsStyle the elements inside the component from your own CSS with ::part(). Every fandry component renders in native shadow DOM, so parts work on LWR and Salesforce alike. For colors, spacing, radius and type across many components, set the --fd-* tokens instead. The code for the "Custom colors and parts" example above:
| Part | Description |
|---|---|
base | The outermost element. |
States are extra names on a part while the state is on. Name both to style one state, e.g.fandry-checkbox::part(control checked).
| State | Description |
|---|---|
default | The default look (variant="default"). |
primary | variant="primary". |
success | variant="success". |
warning | variant="warning". |
danger | variant="danger". |
<!-- template -->
<div class="brand row">
<fandry-badge variant="danger">Sale</fandry-badge>
<fandry-badge variant="success">New</fandry-badge>
<fandry-badge variant="primary">Buy 2, get 1 free</fandry-badge>
<fandry-badge>Bestseller</fandry-badge>
</div>
/* css */
/* Scoped to this demo. Set the same --fd-* tokens on :root to theme
every fandry-* component on the site. */
.brand {
--fd-primary: 160 84% 26%;
--fd-success: 160 84% 26%;
--fd-danger: 350 80% 42%;
--fd-bg-muted: 45 90% 90%;
}
fandry-badge::part(base) {
font-weight: 700;
letter-spacing: 0.06em;
text-transform: uppercase;
border-radius: 999px;
}
Code
Link to section Code<fandry-badge variant="primary">New</fandry-badge>