Skip to content

Commit f0ad650

Browse files
committed
feat(CButton): add support for unthemed outline and ghost buttons
1 parent ed1b8df commit f0ad650

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

packages/coreui-vue/src/components/button/CButton.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ export const CButton = defineComponent({
9393
{
9494
class: [
9595
'btn',
96+
props.variant && props.color ? `btn-${props.variant}-${props.color}` : `btn-${props.variant}`,
9697
{
9798
[`btn-${props.color}`]: props.color && !props.variant,
98-
[`btn-${props.variant}-${props.color}`]: props.color && props.variant,
9999
[`btn-${props.size}`]: props.size,
100100
active: props.active,
101101
disabled: props.disabled,

packages/docs/components/button.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,27 @@ If you're using `<CButton>` component as `<a>` elements that are used to trigger
6363

6464
## Outline buttons
6565

66-
If you need a button, but without the strong background colors. Set `variant="outline"` prop to remove all background colors.
66+
### Base outline style
67+
68+
The `variant="outline` property provides a neutral outline button style without any color modifiers. It’s useful as a foundation for minimal buttons without background color or strong visual emphasis.
69+
70+
::: demo
71+
<CButton variant="outline">Base outline button</CButton>
72+
<CButton variant="outline" active>Active state</CButton>
73+
<CButton variant="outline" disabled>Disabled state</CButton>
74+
:::
75+
```vue
76+
<CButton variant="outline">Base outline button</CButton>
77+
<CButton variant="outline" active>Active state</CButton>
78+
<CButton variant="outline" disabled>Disabled state</CButton>
79+
```
80+
81+
These Vue buttons use a transparent background, subtle border, and inherit text color from the parent context. They’re best suited for minimalist UI elements like modals, toolbars, or secondary actions.
82+
83+
84+
### Themed outline variants
85+
86+
If you need a button, but without the strong background colors, set `color` and `variant=" outline"` props to remove all background colors.
6787

6888
::: demo
6989
<CButton color="primary" variant="outline">Primary</CButton>
@@ -86,10 +106,31 @@ If you need a button, but without the strong background colors. Set `variant="ou
86106
<CButton color="dark" variant="outline">Dark</CButton>
87107
```
88108

109+
These outline variants of our Vue.js buttons retain transparent backgrounds by default, but display a background tint on hover or focus to indicate interactivity. They’re ideal for secondary actions when you want to differentiate from the standard buttons visually.
110+
89111
## Ghost buttons
90112

113+
### Base ghost style
114+
115+
Use the `variant="ghost"` property to create ultra-minimalist buttons with no borders and a fully transparent background. These Vue buttons rely solely on text color for visibility and apply a background highlight when hovered over or in an active state.
116+
117+
They’re perfect for interfaces where you want buttons to be present but visually unobtrusive—such as action buttons in modals, cards, or toolbars.
118+
91119
If you need a ghost variant of button, set `variant="ghost"` prop to remove all background colors.
92120

121+
::: demo
122+
<CButton variant="ghost">Base ghost button</CButton>
123+
<CButton variant="ghost" active>Active state</CButton>
124+
<CButton variant="ghost" disabled>Disabled state</CButton>
125+
:::
126+
```vue
127+
<CButton variant="ghost">Base ghost button</CButton>
128+
<CButton variant="ghost" active>Active state</CButton>
129+
<CButton variant="ghost" disabled>Disabled state</CButton>
130+
```
131+
132+
To apply theme colors to Vue ghost buttons, use the `color` and `variant="ghost"` properties. By default, these variants color only the text. On hover or focus, they add a background that corresponds to the theme color.
133+
93134
::: demo
94135
<CButton color="primary" variant="ghost">Primary</CButton>
95136
<CButton color="secondary" variant="ghost">Secondary</CButton>

0 commit comments

Comments
 (0)