Skip to content

Commit 8ee8286

Browse files
committed
fix(COffcanvas): allow passing attributes like class and style to the component
1 parent b65093d commit 8ee8286

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { executeAfterTransition } from '../../utils/transition'
77

88
const COffcanvas = defineComponent({
99
name: 'COffcanvas',
10+
inheritAttrs: false,
1011
props: {
1112
/**
1213
* Apply a backdrop on body while offcanvas is open.
@@ -94,7 +95,7 @@ const COffcanvas = defineComponent({
9495
*/
9596
'show',
9697
],
97-
setup(props, { slots, emit }) {
98+
setup(props, { attrs, emit, slots }) {
9899
const offcanvasRef = ref()
99100
const visible = ref(props.visible)
100101

@@ -175,13 +176,15 @@ const COffcanvas = defineComponent({
175176
h(
176177
'div',
177178
{
179+
...attrs,
178180
class: [
179181
{
180182
[`offcanvas${
181183
typeof props.responsive === 'boolean' ? '' : '-' + props.responsive
182184
}`]: props.responsive,
183185
[`offcanvas-${props.placement}`]: props.placement,
184186
},
187+
attrs.class,
185188
],
186189
onKeydown: (event: KeyboardEvent) => handleKeyDown(event),
187190
ref: offcanvasRef,

0 commit comments

Comments
 (0)