Files
homepage_relaunch/.design-sync/ds-src/Button.tsx
T
2026-09-20 12:45:33 +02:00

27 lines
681 B
TypeScript

import type { ReactNode } from 'react';
import { cx } from './cx';
export interface ButtonProps {
/** Renders an anchor when set, a button element otherwise. */
href?: string;
size?: 'default' | 'small';
children?: ReactNode;
}
/** A filled action. Its label names the action: "Talk to us", never "Learn more". */
export function Button({ href, size = 'default', children }: ButtonProps) {
const className = cx('button', size === 'small' && 'button--small');
if (href) {
return (
<a className={className} href={href}>
{children}
</a>
);
}
return (
<button className={className} type="button">
{children}
</button>
);
}