SGUI / Development
Badge
Host-formatted counts remain accessible without automatic capping.
Loading examples…
Loading examples…
Examples
Loading examples…
Contains
No fixed SGUI child components.
Component documentation
SGUI / Development
Host-formatted counts remain accessible without automatic capping.
Loading examples…
Loading examples…
Loading examples…
No fixed SGUI child components.
Host-formatted counts remain accessible without automatic capping.
'use client';
import { useState } from 'react';
import { ThemeScope } from '@structured-growth/sg-ui/theme';
import { Badge, Stack, Typography, Button } from '@structured-growth/sg-ui/experimental';
export default function BadgePlaygroundExample() {
const [action, setAction] = useState("No action yet");
const [open, setOpen] = useState(false);
const [page, setPage] = useState(0);
const [pageSize, setPageSize] = useState(25);
const [selected, setSelected] = useState("overview");
return (
<>
<ThemeScope density="comfortable">
<Badge content={"12"} tone={"primary"} aria-label={"Unread messages"}><Button variant="outlined">Messages</Button></Badge>
</ThemeScope>
</>
);
}
The same props in independent density scopes.
'use client';
import { useState } from 'react';
import { ThemeScope } from '@structured-growth/sg-ui/theme';
import { Badge, Stack, Typography, Button } from '@structured-growth/sg-ui/experimental';
export default function BadgePlaygroundDensitiesExample() {
const [action, setAction] = useState("No action yet");
const [open, setOpen] = useState(false);
const [page, setPage] = useState(0);
const [pageSize, setPageSize] = useState(25);
const [selected, setSelected] = useState("overview");
return (
<>
<Stack gap={3}>
<ThemeScope density="compact"><Badge content={"12"} tone={"primary"} aria-label={"Unread messages"}><Button variant="outlined">Messages</Button></Badge></ThemeScope>
<ThemeScope density="comfortable"><Badge content={"12"} tone={"primary"} aria-label={"Unread messages"}><Button variant="outlined">Messages</Button></Badge></ThemeScope>
</Stack>
</>
);
}
'use client';
import { useState } from 'react';
import { Badge, Stack, Typography, Button } from '@structured-growth/sg-ui/experimental';
export default function BadgePlaygroundCompositionExample() {
const [action, setAction] = useState("No action yet");
const [open, setOpen] = useState(false);
const [page, setPage] = useState(0);
const [pageSize, setPageSize] = useState(25);
const [selected, setSelected] = useState("overview");
return (
<>
<Stack direction="row" gap={3}><Badge content={0} /><Badge content="99+" tone="neutral" /><Badge content="New"><Button>Updates</Button></Badge></Stack>
</>
);
}