-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Label): add
closeButtonLabel
prop (#292)
* use `<Button/>` for `type=close` appearance * add `closeButtonLabel` prop to customize button `aria-label`
- Loading branch information
Showing
3 changed files
with
66 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,27 @@ | ||
### PropTypes | ||
# Label | ||
|
||
| Property | Type | Required | Default | Description | | ||
| :-------- | :--------------------------------------------------------- | :------- | :---------- | :------------------------------------------------------- | | ||
| theme | `String` | | `normal ` | Label appearance | | ||
| type | `String` | | `default` | Label type (plain, with text to copy or with cross icon) | | ||
| size | `String` | | `xs` | Label size | | ||
| style | `String` | | `default` | Button style (default or rounded corners) | | ||
| tooltip | `TooltipProps` | | `undefined` | Tooltip | | ||
| icon | `ReactNode` | | `undefined` | Icon at the left | | ||
| disabled | `Boolean` | | `undefined` | disabled state | | ||
| onClose | `onClose?(event: React.MouseEvent<HTMLDivElement>): void;` | | `undefined` | Button with cross handler | | ||
| copyText | `String` | | `undefined` | Text to copy | | ||
| onCopy | `onCopy?(text: string, result: boolean): void;` | | `undefined` | Callback after copy | | ||
| onClick | `onClose?(event: React.MouseEvent<HTMLDivElement>): void;` | | `undefined` | Handler for element click | | ||
| className | `String` | | `undefined` | Class name | | ||
## PropTypes | ||
|
||
| Property | Type | Required | Default | Description | | ||
| :--------------- | :--------------------------------------------------------- | :------- | :---------- | :------------------------------------------------------- | | ||
| theme | `String` | | `normal ` | Label appearance | | ||
| type | `String` | | `default` | Label type (plain, with text to copy or with cross icon) | | ||
| size | `String` | | `xs` | Label size | | ||
| style | `String` | | `default` | Button style (default or rounded corners) | | ||
| tooltip | `TooltipProps` | | `undefined` | Tooltip | | ||
| icon | `ReactNode` | | `undefined` | Icon at the left | | ||
| disabled | `Boolean` | | `undefined` | disabled state | | ||
| onClose | `onClose?(event: React.MouseEvent<HTMLDivElement>): void;` | | `undefined` | Button with cross handler | | ||
| copyText | `String` | | `undefined` | Text to copy | | ||
| closeButtonLabel | `String` | | `undefined` | Text of `aria-label` of button with cross | | ||
| onCopy | `onCopy?(text: string, result: boolean): void;` | | `undefined` | Callback after copy | | ||
| onClick | `onClose?(event: React.MouseEvent<HTMLDivElement>): void;` | | `undefined` | Handler for element click | | ||
| className | `String` | | `undefined` | Class name | | ||
|
||
## Example | ||
|
||
```tsx | ||
<Label type="close" closeButtonLabel='Remove tag "Foobar"' onClose={removeTag}> | ||
Foobar | ||
</Label> | ||
``` |