mantine icon indicating copy to clipboard operation
mantine copied to clipboard

[@mantine/core] Group: extend props with BoxProps

Open zeropaper opened this issue 3 years ago • 4 comments

I was looking to create a (HTML) <header> whit the styling of a Group.
Since the (others) props are spread and the Box component has a component prop that would accept a header value.

Not sure if some omitting should be done (Omit<BoxProps, '...'>) tho.

zeropaper avatar Aug 09 '22 05:08 zeropaper

Group already has all BoxProps – it extends DefaultProps which is basically the same thing in this context.

rtivital avatar Aug 09 '22 05:08 rtivital

I may miss something but... I'm getting a TS error when trying to use something like

<Group component="header">
  {/* ... */}
</Group>

https://codesandbox.io/s/pedantic-goldstine-bh135s?file=/src/App.tsx

zeropaper avatar Aug 09 '22 06:08 zeropaper

Group is not supposed to be used as polymorphic component – it manages layout, not functionality, you should wrap it with header element instead:

<header><Group /></header>

rtivital avatar Aug 09 '22 07:08 rtivital

I guess I'll rather style the header element with some "good'ol CSS" than nesting elements and cluttering the DOM to achieve that.

Thanks anyways.

On Tue, Aug 9, 2022, 09:37 Vitaly Rtishchev @.***> wrote:

Group is not supposed to be used as polymorphic component – it manages layout, not functionality, you should wrap it with header element instead:

— Reply to this email directly, view it on GitHub https://github.com/mantinedev/mantine/pull/2053#issuecomment-1209023279, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQDM2W2EMFQMLYJVQ3C7LVYIDCVANCNFSM557OCGNQ . You are receiving this because you authored the thread.Message ID: @.***>

zeropaper avatar Aug 09 '22 08:08 zeropaper