Skip to content

Commit b61426c

Browse files
committed
feat(CCarosuel): add dark variant
1 parent 8c1f12b commit b61426c

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

packages/coreui-vue/src/components/offcanvas/COffcanvas.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ const COffcanvas = defineComponent({
2626
return false
2727
},
2828
},
29+
/**
30+
* Sets a darker color scheme.
31+
*/
32+
dark: Boolean,
2933
/**
3034
* Closes the offcanvas when escape key is pressed.
3135
*/
@@ -182,6 +186,7 @@ const COffcanvas = defineComponent({
182186
ref: offcanvasRef,
183187
role: 'dialog',
184188
tabindex: -1,
189+
...(props.dark && { 'data-coreui-theme': 'dark' }),
185190
},
186191
slots.default && slots.default(),
187192
),

packages/docs/components/offcanvas.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,36 @@ If you set a `backdrop` to `static`, your Vue offcanvas component will not close
205205
</script>
206206
```
207207

208+
## Dark offcanvas
209+
210+
Change the appearance of offcanvases with `dark` boolean property to better match them to different contexts like dark navbars.
211+
212+
::: demo
213+
<div class="docs-example-offcanvas bg-body-secondary p-0 overflow-hidden">
214+
<COffcanvas :backdrop="false" dark placement="start" :visible="true">
215+
<COffcanvasHeader>
216+
<COffcanvasTitle>Offcanvas</COffcanvasTitle>
217+
<CCloseButton class="text-reset" />
218+
</COffcanvasHeader>
219+
<COffcanvasBody>
220+
Content for the offcanvas goes here. You can place just about any React component or custom elements here.
221+
</COffcanvasBody>
222+
</COffcanvas>
223+
</div>
224+
:::
225+
```vue
226+
<COffcanvas :backdrop="false" dark placement="start" :visible="true">
227+
<COffcanvasHeader>
228+
<COffcanvasTitle>Offcanvas</COffcanvasTitle>
229+
<CCloseButton class="text-reset" />
230+
</COffcanvasHeader>
231+
<COffcanvasBody>
232+
Content for the offcanvas goes here. You can place just about any React component or custom elements here.
233+
</COffcanvasBody>
234+
</COffcanvas>
235+
```
236+
237+
208238
## Responsive
209239

210240
Responsive offcanvas properties hide content outside the viewport from a specified breakpoint and down.

0 commit comments

Comments
 (0)