Skip to content

Commit e85bb99

Browse files
committed
fix(COffcanvas): allow passing attributes like class and style to the component
1 parent 3e249b6 commit e85bb99

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

+4-1
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.
@@ -90,7 +91,7 @@ const COffcanvas = defineComponent({
9091
*/
9192
'show',
9293
],
93-
setup(props, { slots, emit }) {
94+
setup(props, { attrs, emit, slots }) {
9495
const offcanvasRef = ref()
9596
const visible = ref(props.visible)
9697

@@ -170,13 +171,15 @@ const COffcanvas = defineComponent({
170171
h(
171172
'div',
172173
{
174+
...attrs,
173175
class: [
174176
{
175177
[`offcanvas${
176178
typeof props.responsive === 'boolean' ? '' : '-' + props.responsive
177179
}`]: props.responsive,
178180
[`offcanvas-${props.placement}`]: props.placement,
179181
},
182+
attrs.class,
180183
],
181184
onKeydown: (event: KeyboardEvent) => handleKeyDown(event),
182185
ref: offcanvasRef,

0 commit comments

Comments
 (0)