17 lines
517 B
TypeScript
17 lines
517 B
TypeScript
type FormTab = { id: string; label: string };
|
|
|
|
export function FormTabs({ tabs, active, onChange }: { tabs: FormTab[]; active: string; onChange: (id: string) => void }) {
|
|
return <div className="form-tabs" role="tablist" aria-label="بخشهای فرم">
|
|
{tabs.map(tab => <button
|
|
key={tab.id}
|
|
type="button"
|
|
role="tab"
|
|
aria-selected={active === tab.id}
|
|
className={active === tab.id ? "active" : ""}
|
|
onClick={() => onChange(tab.id)}
|
|
>{tab.label}</button>)}
|
|
</div>;
|
|
}
|
|
|
|
|