themesberg / flowbite-react

Official React components built for Flowbite and Tailwind CSS
https://flowbite-react.com
MIT License
1.89k stars 423 forks source link

Button in ButtonGroup ignores `theme` prop #1252

Open dhe128 opened 9 months ago

dhe128 commented 9 months ago

Steps to reproduce

<ButtonGroup theme={{position: {start: 'x'}}}>
  <Button />
</ButtonGroup>

Current behavior

First button in button group should have class="x"

Expected behavior

class="x" is missing

Context

Button component doesn't use props.theme of parent ButtonGroup.

https://github.com/themesberg/flowbite-react/blob/4fd01e5a5631c30ea65f90fd23856eae8014ccad/src/components/Button/Button.tsx#L118

SutuSebastian commented 9 months ago

Known issue, its because ButtonGroup uses React.cloneElement under the hood to inject some props, but does not apply top level theme override configuration.

Will be fixed in the next patch.