added full-width option to button

This commit is contained in:
Grzegorz Leoniec 2018-10-11 10:15:31 +02:00
parent 4c5d923284
commit f344e3803a
3 changed files with 25 additions and 7 deletions

View File

@ -9,20 +9,21 @@
danger && `ds-button-danger`, danger && `ds-button-danger`,
ghost && `ds-button-ghost`, ghost && `ds-button-ghost`,
iconOnly && `ds-button-icon-only`, iconOnly && `ds-button-icon-only`,
hover && `ds-button-hover` hover && `ds-button-hover`,
fullWidth && `ds-button-full-width`
]" ]"
v-bind="bindings" v-bind="bindings"
:is="linkTag"> :is="linkTag">
<ds-icon <ds-icon
v-if="icon" v-if="icon"
:name="icon"/> :name="icon"/>
<span <span
class="ds-button-text" class="ds-button-text"
v-if="$slots.default"> v-if="$slots.default">
<slot /> <slot />
</span> </span>
<ds-icon <ds-icon
v-if="iconRight" v-if="iconRight"
:name="iconRight"/> :name="iconRight"/>
</component> </component>
</template> </template>
@ -122,6 +123,13 @@ export default {
iconRight: { iconRight: {
type: String, type: String,
default: null default: null
},
/**
* Should the button spread to the full with of the parent?
*/
fullWidth: {
type: Boolean,
default: false
} }
}, },
computed: { computed: {

View File

@ -32,6 +32,12 @@ Use different sizes to create hierarchy.
<ds-button size="large">Large</ds-button> <ds-button size="large">Large</ds-button>
``` ```
## Button full width
```
<ds-button full-width>Full Width</ds-button>
```
## Button states ## Button states
A button can take different states. A button can take different states.
@ -60,4 +66,4 @@ Provide a path to the button. You can pass a url string or a Vue router path obj
``` ```
<ds-button path="/navigation">Click me</ds-button> <ds-button path="/navigation">Click me</ds-button>
<ds-button :path="{ name: 'Navigation' }">Click me</ds-button> <ds-button :path="{ name: 'Navigation' }">Click me</ds-button>
``` ```

View File

@ -202,3 +202,7 @@
margin-right: 0; margin-right: 0;
} }
} }
.ds-button-full-width {
width: 100%;
}