summaryrefslogtreecommitdiffstats
path: root/src/ui/objects/Badge.tsx
blob: e98ef0d50e93f7d364b42fac5c2262fe8a50c87d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import type { HTMLTag, Polymorphic } from "corvos/plugins/jsx.ts";

import type { Props as ActionButtonProps } from "./ActionButton.tsx";

import { ActionButton } from "./ActionButton.tsx";

export type Props<Tag extends HTMLTag> = Polymorphic<{
	as?: Tag;
	variant?: ActionButtonProps<Tag>["variant"];
	pill?: boolean;
	selected?: boolean;
	size?: ActionButtonProps<Tag>["size"];
	children?: JSX.Element;
}>;

export const Badge = <T extends HTMLTag = "span">({ as = "span" as T, ...props }: Props<T>) => (
	// deno-lint-ignore no-explicit-any
	<ActionButton as={as} level="badge" {...(props as any)} />
);