import React, { forwardRef } from 'react'; export type FieldsetTone = 'default' | 'subtle'; export interface FieldsetProps extends React.FieldsetHTMLAttributes { legend?: React.ReactNode; tone?: FieldsetTone; } export const Fieldset = forwardRef( ({ legend, tone = 'default', className = '', children, ...rest }, ref) => { const classes = [ 'fieldset', tone !== 'default' && `fieldset--${tone}`, className ] .filter(Boolean) .join(' '); return (
{legend !== undefined && ( {legend} )} {children}
); } ); Fieldset.displayName = 'Fieldset';