UNPKG

@ui5/webcomponents-react

Version:

React Wrapper for UI5 Web Components and additional components

111 lines (110 loc) 5.06 kB
import '@ui5/webcomponents/dist/Tab.js'; import type { TabClickEventDetail } from '@ui5/webcomponents/dist/Tab.js'; import type SemanticColor from '@ui5/webcomponents/dist/types/SemanticColor.js'; import type { CommonProps, Ui5CustomEvent, Ui5DomRef, UI5WCSlotsNode } from '@ui5/webcomponents-react-base'; import type { ReactNode } from 'react'; interface TabAttributes { /** * Represents the "additionalText" text, which is displayed in the tab. In the cases when in the same time there are tabs with icons and tabs without icons, if a tab has no icon the "additionalText" is displayed larger. * @default undefined */ additionalText?: string | undefined; /** * Defines the component's design color. * * The design is applied to: * * - the component icon * - the `text` when the component overflows * - the tab selection line * * Available designs are: `"Default"`, `"Neutral"`, `"Positive"`, `"Critical"` and `"Negative"`. * * **Note:** The design depends on the current theme. * @default "Default" */ design?: SemanticColor | keyof typeof SemanticColor; /** * Disabled tabs can't be selected. * @default false */ disabled?: boolean; /** * Defines the icon source URI to be displayed as graphical element within the component. * The SAP-icons font provides numerous built-in icons. * See all the available icons in the [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html). * @default undefined */ icon?: string | undefined; /** * Defines if the tab is movable. * * **Note:** Available since [v2.0.0](https://github.com/UI5/webcomponents/releases/tag/v2.0.0) of **@ui5/webcomponents**. * @default false */ movable?: boolean; /** * Specifies if the component is selected. * @default false */ selected?: boolean; /** * The text to be displayed for the item. * @default undefined */ text?: string | undefined; } interface TabDomRef extends Required<TabAttributes>, Ui5DomRef { /** * Returns the DOM reference of the tab that is placed in the header. * * **Note:** Tabs, placed in the `items` slot of other tabs are not shown in the header. Calling this method on such tabs will return `undefined`. * * **Note:** If you need a DOM ref to the tab content please use the `getDomRef` method. * @returns {HTMLElement | undefined} */ getDomRefInStrip: () => HTMLElement | undefined; } interface TabPropTypes extends TabAttributes, Omit<CommonProps, keyof TabAttributes | 'children' | 'items' | 'onClick'> { /** * Holds the content associated with this tab. * * __Supported Node Type/s:__ `Array<Node>` */ children?: ReactNode | ReactNode[]; /** * Defines hierarchies with nested sub tabs. * * **Note:** Use `Tab` and `TabSeparator` for the intended design. * * __Note:__ The content of the prop will be rendered into a [&lt;slot&gt;](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot) by assigning the respective [slot](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/slot) attribute (`slot="items"`). * Since you can't change the DOM order of slots when declaring them within a prop, it might prove beneficial to manually mount them as part of the component's children, especially when facing problems with the reading order of screen readers. * * __Note:__ When passing a custom React component to this prop, you have to make sure your component reads the `slot` prop and appends it to the most outer element of your component. * Learn more about it [here](https://ui5.github.io/webcomponents-react/v2/?path=/docs/knowledge-base-handling-slots--docs). * * __Supported Node Type/s:__ `Array<ITab>` */ items?: UI5WCSlotsNode; /** * Fired when the tab is selected either with a mouse/tap or by using the Enter or Space key. * * **Note:** Available since [v2.23.0](https://github.com/UI5/webcomponents/releases/tag/v2.23.0) of **@ui5/webcomponents**. * * | cancelable | bubbles | * | :--------: | :-----: | * | ❌|✅| */ onClick?: (event: Ui5CustomEvent<TabDomRef, TabClickEventDetail>) => void; } /** * The `Tab` represents a selectable item inside a `TabContainer`. * It defines both the item in the tab strip (top part of the `TabContainer`) and the * content that is presented to the user once the tab is selected. * * __Note:__ This is a UI5 Web Component! [Tab UI5 Web Component Documentation](https://ui5.github.io/webcomponents/components/Tab) | [Repository](https://github.com/UI5/webcomponents) * @abstract */ declare const Tab: import("react").ForwardRefExoticComponent<TabPropTypes & import("@ui5/webcomponents-react-base").WithWebComponentPropTypes & import("react").RefAttributes<TabDomRef>>; export { Tab }; export type { TabDomRef, TabPropTypes };