← Files NGS Analysis WorkbenchARCHIVED FILE
src/design-system/Chip.tsx
867 Bytes · Sep 30, 2026 · 23:20 UTC
import type { HTMLAttributes, ReactNode } from "react";
import { StatusIcon } from "./Icon";
import styles from "./Chip.module.css";
export type ChipTone = "neutral" | "info" | "success" | "warning" | "danger";
export function Chip({
children,
className,
icon,
tone = "neutral",
...props
}: HTMLAttributes<HTMLSpanElement> & {
icon?: ReactNode;
tone?: ChipTone;
}) {
return (
<span
{...props}
className={[styles.chip, className].filter(Boolean).join(" ")}
data-ngs-chip=""
data-tone={tone}
>
{icon}
{children}
</span>
);
}
export function StatusChip({
active = false,
tone,
...props
}: Omit<Parameters<typeof Chip>[0], "icon"> & { active?: boolean }) {
return (
<Chip
{...props}
tone={tone}
icon={<StatusIcon tone={tone ?? "neutral"} active={active} />}
/>
);
}
SHA-256: 74b677d8cc553b3b8006f3ca043ad1c5c60227571e351ef51efcbe8e1fc655ee