Skip to content

Commit 66f368e

Browse files
authored
feat: provide the new width property (#2677)
feat: provide a the new width property
1 parent a673596 commit 66f368e

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

packages/db-ui-elements-stencil/src/components/db-button/db-button.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ export class DbButton {
8080
*/
8181
@Prop({ reflect: true }) value?: string;
8282

83+
/**
84+
* The width attribute let's you overwrite the standard display of the button width.
85+
*/
86+
@Prop({ reflect: true }) width?: 'auto' | 'full';
87+
8388
/**
8489
* The variant attribute specifies a visual expression of button.
8590
*/
@@ -113,6 +118,7 @@ export class DbButton {
113118
type={this.type}
114119
value={this.value}
115120
data-size={this.size}
121+
data-width={this.width}
116122
>
117123
{this.icon ? <db-icon icon={this.icon} /> : null}
118124
<slot />

packages/db-ui-elements-stencil/src/components/db-button/readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
| `type` | `type` | The type attribute specifies the type of button. | `"button" \| "reset" \| "submit"` | `'submit'` |
2727
| `value` | `value` | The value attribute specifies an initial value for the button. | `string` | `undefined` |
2828
| `variant` | `variant` | The variant attribute specifies a visual expression of button. | `"brand-primary" \| "primary" \| "secondary-outline" \| "secondary-solid" \| "tertiary-plain"` | `undefined` |
29+
| `width` | `width` | The width attribute let's you overwrite the standard display of the button width. | `"auto" \| "full"` | `undefined` |
2930

3031

3132
## Dependencies

packages/db-ui-elements-stencil/src/components/db-button/stories/button.intro.stories.mdx

+8
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ You could set the icons position – either before or after the text – by usin
4646
<db-button variant="secondary-outline" icon="download">Secondary Outline</db-button> <db-button variant="secondary-outline" iconafter="download">Secondary Outline</db-button>
4747
</Canvas>
4848

49+
<db-headline variant="2">width</db-headline>
50+
51+
Regularly, our buttons shouldn't increase to it's horizontally available space, but only the one determined by it's included textual content. Use `width` property with the value of `full` to overwrite this definition.
52+
53+
<Canvas>
54+
<db-button variant="brand-primary">(Default) Auto width</db-button><span style={{display: "inline-block", width: "500px"}}><db-button variant="brand-primary" width="full">Width full</db-button></span>
55+
</Canvas>
56+
4957
<db-headline variant="2">icononly (only use with care)</db-headline>
5058

5159
If you'd only like to display the icon without any text, you could set the attribute `icononly` on the button component. But please keep in mind that a visual text ensures clarity on the subject of this button as well enables use cases like controlling the page by voice (accessibility).

packages/db-ui-elements-stencil/src/components/db-input/readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
| `label` _(required)_ | `label` | The label attribute specifies the caption of the input. | `string` | `undefined` |
2121
| `labelHidden` | `label-hidden` | The label-hidden attribute is a boolean attribute. When specified, the elements label gets visually hidden (it's important to still keep it displayed for accessibility reasons). | `string` | `undefined` |
2222
| `list` | `list` | The list attribute is used to identify an element that lists predefined options suggested to the user. | `string` | `undefined` |
23-
| `max` | `max` | The max attribute specifies the maximum value that is sufficient for this input. | `number \| string` | `undefined` |
23+
| `max` | `max` | The max attribute specifies the maximum value that is sufficient for this input. | `number \| string` | `undefined` |
2424
| `maxlength` | `maxlength` | /* The maxlength attribute, controlled by a dirty value flag, declares a limit on the number of characters a user can input. | `number` | `undefined` |
25-
| `min` | `min` | The min attribute specifies the minimum value that is sufficient for this input. | `number \| string` | `undefined` |
25+
| `min` | `min` | The min attribute specifies the minimum value that is sufficient for this input. | `number \| string` | `undefined` |
2626
| `minlength` | `minlength` | /* The minlength attribute, when it applies, is a form control minlength attribute. | `number` | `undefined` |
2727
| `name` | `name` | The name content attribute gives the name of the form control, as used in form submission and in the form element's elements object. If the attribute is specified, its value must not be the empty string. | `string` | `undefined` |
2828
| `pattern` | `pattern` | The pattern attribute specifies a regular expression against which the control's value is to be checked. | `string` | `undefined` |

0 commit comments

Comments
 (0)