Skip to content

Commit 821d38f

Browse files
committed
feat(DesignSystem): add HTMLAttributes to ButtonGroup
1 parent 5c53570 commit 821d38f

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

packages/design-system/src/lib/components/button-group/ButtonGroup.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { PropsWithChildren } from 'react'
22
import { ButtonGroup as ButtonGroupBS } from 'react-bootstrap'
33
import styles from './ButtonGroup.module.scss'
4+
import * as React from 'react'
45

5-
interface ButtonGroupProps {
6+
interface ButtonGroupProps extends React.HTMLAttributes<HTMLElement> {
67
vertical?: boolean
78
}
89

9-
export function ButtonGroup({ vertical, children }: PropsWithChildren<ButtonGroupProps>) {
10+
export function ButtonGroup({ vertical, children, ...props }: PropsWithChildren<ButtonGroupProps>) {
1011
return (
11-
<ButtonGroupBS vertical={vertical} className={styles.border}>
12+
<ButtonGroupBS vertical={vertical} className={styles.border} {...props}>
1213
{children}
1314
</ButtonGroupBS>
1415
)

packages/design-system/tests/component/button-group/ButtonGroup.spec.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,10 @@ describe('ButtonGroup', () => {
2525

2626
cy.findByRole('group').should('not.have.class', 'btn-group-vertical')
2727
})
28+
29+
it('renders html attributes', () => {
30+
cy.mount(<ButtonGroup data-testid="button-group" aria-label="button group" />)
31+
32+
cy.findByRole('group').should('have.attr', 'aria-label', 'button group')
33+
})
2834
})

0 commit comments

Comments
 (0)