File tree Expand file tree Collapse file tree
apps/storybook/src/stories/components/buttons
packages/webkit/src/components/buttons Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,6 +32,10 @@ export default {
3232 control : 'boolean' ,
3333 description : 'Whether the button is outlined'
3434 } ,
35+ loading : {
36+ control : 'boolean' ,
37+ description : 'Whether the button shows loading state'
38+ } ,
3539 disabled : {
3640 control : 'boolean' ,
3741 description : 'Whether the button is disabled'
@@ -86,6 +90,14 @@ export const Disabled = {
8690 }
8791} ;
8892
93+ export const Loading = {
94+ args : {
95+ label : 'Creating...' ,
96+ loading : true ,
97+ size : 'large'
98+ }
99+ } ;
100+
89101export const Secondary = {
90102 args : {
91103 label : 'Create New' ,
Original file line number Diff line number Diff line change @@ -32,6 +32,10 @@ export default {
3232 control : 'boolean' ,
3333 description : 'Whether the button is outlined'
3434 } ,
35+ loading : {
36+ control : 'boolean' ,
37+ description : 'Whether the button shows loading state'
38+ } ,
3539 disabled : {
3640 control : 'boolean' ,
3741 description : 'Whether the button is disabled'
@@ -70,6 +74,14 @@ export const Disabled = {
7074 }
7175} ;
7276
77+ export const Loading = {
78+ args : {
79+ label : 'Deleting...' ,
80+ loading : true ,
81+ size : ''
82+ }
83+ } ;
84+
7385export const WithCustomIcon = {
7486 args : {
7587 label : 'Delete' ,
Original file line number Diff line number Diff line change 11<script setup>
2+ import { computed } from ' vue'
23import Button from ' primevue/button'
34
45const props = defineProps ({
@@ -9,12 +10,16 @@ const props = defineProps({
910 severity: { type: String , default: ' primary' },
1011 size: { type: String , default: ' ' },
1112 outlined: { type: Boolean , default: false },
13+ loading: { type: Boolean , default: false },
1214 disabled: { type: Boolean , default: false }
1315})
1416
1517const emit = defineEmits ([' click' ])
1618
19+ const computedDisabled = computed (() => props .disabled || props .loading )
20+
1721const handleClick = () => {
22+ if (computedDisabled .value ) return
1823 emit (' click' )
1924}
2025 </script >
@@ -27,7 +32,8 @@ const handleClick = () => {
2732 :severity =" severity"
2833 :size =" size"
2934 :outlined =" outlined"
30- :disabled =" disabled"
35+ :disabled =" computedDisabled"
36+ :loading =" loading"
3137 :aria-label =" label"
3238 :data-testid =" data-testid"
3339 @click =" handleClick"
Original file line number Diff line number Diff line change 11<script setup>
2+ import { computed } from ' vue'
23import Button from ' primevue/button'
34
45const props = defineProps ({
@@ -9,12 +10,16 @@ const props = defineProps({
910 severity: { type: String , default: ' danger' },
1011 size: { type: String , default: ' ' },
1112 outlined: { type: Boolean , default: true },
13+ loading: { type: Boolean , default: false },
1214 disabled: { type: Boolean , default: false }
1315})
1416
1517const emit = defineEmits ([' click' ])
1618
19+ const computedDisabled = computed (() => props .disabled || props .loading )
20+
1721const handleClick = () => {
22+ if (computedDisabled .value ) return
1823 emit (' click' )
1924}
2025 </script >
@@ -27,7 +32,8 @@ const handleClick = () => {
2732 :severity =" severity"
2833 :size =" size"
2934 :outlined =" outlined"
30- :disabled =" disabled"
35+ :disabled =" computedDisabled"
36+ :loading =" loading"
3137 :aria-label =" label"
3238 :data-testid =" data-testid"
3339 @click =" handleClick"
You can’t perform that action at this time.
0 commit comments