UNPKG

@ui5/webcomponents-react

Version:

React Wrapper for UI5 Web Components and additional components

24 lines (23 loc) 1.15 kB
'use client'; import '@ui5/webcomponents/dist/Switch.js'; import { withWebComponent } from '../../internal/withWebComponent.js'; /** * The `Switch` component is used for changing between binary states. * * The component can display texts, that will be switched, based on the component state, via the `textOn` and `textOff` properties, * but texts longer than 3 letters will be cutted off. * * However, users are able to customize the width of `Switch` with pure CSS (`<Switch style="width: 200px">`), and set widths, depending on the texts they would use. * * Note: the component would not automatically stretch to fit the whole text width. * * ### Keyboard Handling * The state can be changed by pressing the Space and Enter keys. * * * * __Note__: This is a UI5 Web Component! [Repository](https://github.com/SAP/ui5-webcomponents) | [Documentation](https://sap.github.io/ui5-webcomponents/) */ const Switch = withWebComponent('ui5-switch', ['accessibleName', 'accessibleNameRef', 'design', 'name', 'textOff', 'textOn', 'tooltip'], ['checked', 'disabled', 'required'], [], ['change']); Switch.displayName = 'Switch'; export { Switch };