@carbon/react
Version:
React components for the Carbon Design System
33 lines (32 loc) • 1.01 kB
TypeScript
/**
* Copyright IBM Corp. 2016, 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { type ReactNode } from 'react';
export interface BaseSwitcherProps {
/**
* expects to receive <SwitcherItem />
*/
children: ReactNode;
/**
* Optionally provide a custom class to apply to the underlying `<ul>` node
*/
className?: string;
/**
* Specify whether the panel is expanded
*/
expanded?: boolean;
}
interface SwitcherWithAriaLabel extends BaseSwitcherProps {
'aria-label': string;
'aria-labelledby'?: never;
}
interface SwitcherWithAriaLabelledBy extends BaseSwitcherProps {
'aria-label'?: never;
'aria-labelledby': string;
}
type SwitcherProps = SwitcherWithAriaLabel | SwitcherWithAriaLabelledBy;
declare const Switcher: React.ForwardRefExoticComponent<SwitcherProps & React.RefAttributes<HTMLUListElement>>;
export default Switcher;