A badge is a compact visual label or indicator used to convey status or display short pieces of information.
Badges are small visual indicators that highlight quick, essential information. Use a badge to draw attention to a piece of content, such as a count, a status, or a short label.
Because badges are not interactive, they aren't meant to group, sort, or filter information. When you need those interactions, use tags instead.
<daff-badge>1</daff-badge>
When to use
When not to use
Import DAFF_BADGE_COMPONENTS into your component:
import { DAFF_BADGE_COMPONENTS } from '@daffodil/design/badge';
@Component({
selector: 'custom-component',
templateUrl: './custom-component.component.html',
imports: [
DAFF_BADGE_COMPONENTS,
],
})
export class CustomComponent {}
A badge is composed of a wrapper, an optional prefix, and a label:
<daff-badge>
<fa-icon [icon]="faCircleCheck" daffPrefix></fa-icon>
Badge label
</daff-badge>
<daff-badge>: The wrapper component that holds the badge content.[daffPrefix]: A leading visual, typically an icon, displayed before the label.Use the [daffPrefix] element to display a leading visual icon before the badge label.
<daff-badge status="success">
<fa-icon [icon]="faCircleCheck" daffPrefix></fa-icon>
Verified
</daff-badge>
Use the appearance property to change the visual style of a badge.
<daff-badge appearance="filled">Filled</daff-badge>
<daff-badge appearance="outlined">Outlined</daff-badge>
Use the color property to change the color of a badge. The default color is light.
<div class="daff-example-badge-colors__wrapper">
<daff-badge color="primary">Primary</daff-badge>
<daff-badge color="secondary">Secondary</daff-badge>
<daff-badge color="tertiary">Tertiary</daff-badge>
<daff-badge color="theme">Theme</daff-badge>
<daff-badge color="theme-contrast">Theme Contrast</daff-badge>
<daff-badge color="dark">Dark</daff-badge>
<daff-badge color="light">Light</daff-badge>
</div>
<div class="daff-example-badge-colors__wrapper">
<daff-badge appearance="outlined" color="primary">Primary</daff-badge>
<daff-badge appearance="outlined" color="secondary">Secondary</daff-badge>
<daff-badge appearance="outlined" color="tertiary">Tertiary</daff-badge>
<daff-badge appearance="outlined" color="theme">Theme</daff-badge>
<daff-badge appearance="outlined" color="theme-contrast">Theme Contrast</daff-badge>
<daff-badge appearance="outlined" color="dark">Dark</daff-badge>
<daff-badge appearance="outlined" color="light">Light</daff-badge>
</div>
Use the size property to change the size of a badge. The default size is md.
<daff-badge size="sm">Small</daff-badge>
<daff-badge size="md">Medium</daff-badge>
<daff-badge size="lg">Large</daff-badge>
Use the status property to convey semantic meaning. A status takes precedence over color.
<div class="daff-example-badge-statuses__wrapper">
<daff-badge status="info">Info</daff-badge>
<daff-badge status="warn">Warn</daff-badge>
<daff-badge status="critical">Critical</daff-badge>
<daff-badge status="success">Success</daff-badge>
</div>
<div class="daff-example-badge-statuses__wrapper">
<daff-badge status="info" appearance="outlined">Info</daff-badge>
<daff-badge status="warn" appearance="outlined">Warn</daff-badge>
<daff-badge status="critical" appearance="outlined">Critical</daff-badge>
<daff-badge status="success" appearance="outlined">Success</daff-badge>
</div>
Badges are not interactive and do not receive focus.
status property to communicate semantic meaning