Badge
The Badge is a component that can be used in conjunction with a Card
component or on its own. It shows the text inside a flag-like box in the top-
left corner of the card. By default the box is brand-colored, but a custom color
can be set as well. When used with the Card component, it can be used e.g. to
specifically highlight its contents or to give some additional information about
how the content of this exact card differs from other cards. When used without
the Card component, it can be used as a tag e.g. above headings inside a Hero component.
Usage
The badge can simply be imported from the design system like this:
import Badge from "@finanzchef24gmbh/design-system/src/Badge";
Props
| Property name | Type | Required | Values | Default |
|---|---|---|---|---|
outset | string | all Spacing scales are allowed | small | |
shouldWrap | boolean | true or false | true | |
color | string | any predefined theme color palette set in contentful | brand | |
outline | boolean | true or false | false |
- The
outsetdetermines how far the badge will stand out from the border of the card. - The
shouldWrapdetermines whether the badge will have the little wrap around the card look. - The
colordetermines the color of the badge. - The
outlinedetermines whether the badge has an outline.
<Card>
<Badge outset="small">This is special!</Badge>
<Spacings.Inset>Hello World</Spacings.Inset>
</Card>
This is special!
Hello World
<Badge shouldWrap={false}>This is special!</Badge>
This is special!
<Badge shouldWrap outset="small" outline>
This is special outset small true!
</Badge>
This is special outset small true!
<Badge shouldWrap={false} color="accent" outline={true}>
<Text color="accent">Test</Text>
</Badge>
Test
<Badge color="auxiliary">
<Text isOnDarkBackground>Test me with other color</Text>
</Badge>
Test me with other color