|
| 1 | +import {ArgsTable, Canvas, Meta, Story} from '@storybook/addon-docs/blocks'; |
| 2 | +import {Button} from '@ui5/webcomponents-react/lib/Button'; |
| 3 | +import {ButtonDesign} from '@ui5/webcomponents-react/lib/ButtonDesign'; |
| 4 | +import '@ui5/webcomponents-icons/dist/icons/employee.js'; |
| 5 | +import {CSSProperties} from 'react'; |
| 6 | + |
| 7 | +import {createSelectArgTypes} from '@shared/stories/createSelectArgTypes'; |
| 8 | +import {DocsHeader} from '@shared/stories/DocsHeader'; |
| 9 | + |
| 10 | +<Meta |
| 11 | + title="UI5 Web Components / Button" |
| 12 | + component={Button} |
| 13 | + argTypes={{ |
| 14 | + ...createSelectArgTypes({design: ButtonDesign}), |
| 15 | + children: {control: 'text'}, |
| 16 | + slot: {control: {disable: true}}, |
| 17 | + ref: {control: {disable: true}}, |
| 18 | + style: { |
| 19 | + type: CSSProperties, |
| 20 | + description: |
| 21 | + 'Element style which will be appended to the most outer element of a component. Use this prop carefully, some css properties might break the component.' |
| 22 | + }, |
| 23 | + className: { |
| 24 | + type: 'string', |
| 25 | + description: |
| 26 | + 'CSS Class Name which will be appended to the most outer element of a component. Use this prop carefully, overwriting CSS rules might break the component.' |
| 27 | + }, |
| 28 | + tooltip: {type: 'string', description: 'A tooltip which will be shown on hover'} |
| 29 | + }} |
| 30 | + args={{ |
| 31 | + design: ButtonDesign.Default, |
| 32 | + icon: 'employee', |
| 33 | + children: 'Button Text', |
| 34 | + style: {}, |
| 35 | + className: '', |
| 36 | + tooltip: '', |
| 37 | + slot: '', |
| 38 | + ref: null |
| 39 | + }} |
| 40 | +/> |
| 41 | + |
| 42 | +<DocsHeader/> |
| 43 | + |
| 44 | +<Canvas> |
| 45 | + <Story name="Default"> |
| 46 | + {(args) => { |
| 47 | + return <Button {...args} />; |
| 48 | + }} |
| 49 | + </Story> |
| 50 | +</Canvas> |
| 51 | + |
| 52 | +<ArgsTable story="."/> |
| 53 | +<div style={{fontFamily: 'var(--sapFontFamily)', fontSize: 'var(--sapFontSize)', color: 'var(--sapTextColor)'}}> |
| 54 | + <h3>Usage</h3> |
| 55 | + For the <code>Button</code> UI, you can define text, icon, or both. You can also specify whether the text or the |
| 56 | + icon is |
| 57 | + displayed first. <br/><br/> |
| 58 | + You can choose from a set of predefined types that offer different styling to correspond to the triggered action. |
| 59 | + <br/><br/> |
| 60 | + You can set the <code>Button</code> as enabled or disabled. An enabled <code>Button</code> can be pressed by |
| 61 | + clicking or |
| 62 | + tapping it. The button changes its style to provide visual feedback to the user that it is pressed or hovered over |
| 63 | + with |
| 64 | + the mouse cursor. A disabled <code>Button</code> appears inactive and cannot be pressed. |
| 65 | +</div> |
0 commit comments