Core@paxeer/core/status-chipimplemented
Status chip
Badge wrapper. Tones map only to MD3 roles.
Install
$
pnpm exec designx add @paxeer/core/status-chipPreview
Loading preview...
Source code
components/designx/core/status-chip.tsxtsx
import { type ComponentProps } from "react";
import { cn } from "../lib/cn";
import { Badge, badgeVariants } from "./badge";
const toneToBadge = {
surface: "ghost",
primary: "default",
secondary: "secondary",
tertiary: "tertiary",
error: "destructive",
outline: "outline",
inverse: "inverse",
} as const;
export interface StatusChipProps extends Omit<ComponentProps<typeof Badge>, "variant"> {
tone?: keyof typeof toneToBadge;
dot?: boolean;
}
export function StatusChip({
className,
tone = "surface",
dot = false,
children,
...props
}: StatusChipProps) {
return (
<Badge
data-slot="status-chip"
variant={toneToBadge[tone]}
className={cn(className)}
{...props}
>
{dot ? (
<span aria-hidden className="size-1.5 rounded-full bg-current opacity-80" />
) : null}
{children}
</Badge>
);
}
export { badgeVariants as statusChipVariants };
Dependencies
Registry dependencies