Skip to content

Commit

Permalink
🛫
Browse files Browse the repository at this point in the history
  • Loading branch information
r100-stack committed Oct 10, 2024
1 parent e9999df commit 323e52a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/tough-shirts-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@itwin/itwinui-react': minor
---

Added new `tileContainer` prop to `RadioTileGroup` to allow further customizing of inner DOM elements.
21 changes: 15 additions & 6 deletions packages/itwinui-react/src/core/RadioTiles/RadioTileGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import * as React from 'react';
import { InputGroup } from '../InputGroup/InputGroup.js';
import { Box } from '../../utils/index.js';
import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
import cx from 'classnames';

type RadioTileGroupProps = Omit<
React.ComponentProps<typeof InputGroup>,
'displayStyle' | 'disabled'
>;
type RadioTileGroupProps = {
tileContainerProps?: React.ComponentProps<'div'>;
} & Omit<React.ComponentProps<typeof InputGroup>, 'displayStyle' | 'disabled'>;

/**
* RadioTileGroup component to group RadioTile components together
Expand All @@ -21,11 +21,20 @@ type RadioTileGroupProps = Omit<
* </RadioTileGroup>
*/
export const RadioTileGroup = React.forwardRef((props, forwardedRef) => {
const { children, label, ...rest } = props;
const { children, label, tileContainerProps, ...rest } = props;

return (
<InputGroup label={label} ref={forwardedRef} {...rest}>
<Box className='iui-radio-tile-container'>{children}</Box>
<Box
as='div'
{...tileContainerProps}
className={cx(
'iui-radio-tile-container',
tileContainerProps?.className,
)}
>
{children}
</Box>
</InputGroup>
);
}) as PolymorphicForwardRefComponent<'div', RadioTileGroupProps>;
Expand Down

0 comments on commit 323e52a

Please sign in to comment.