@carbon/react
Version:
React components for the Carbon Design System
92 lines (91 loc) • 3.17 kB
TypeScript
/**
* Copyright IBM Corp. 2016, 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import PropTypes from 'prop-types';
import { type HTMLAttributes, type ReactNode } from 'react';
type ExcludedAttributes = 'onChange';
export interface TileGroupProps<T = string | number> extends Omit<HTMLAttributes<HTMLFieldSetElement>, ExcludedAttributes> {
/**
* Provide a collection of <RadioTile> components to render in the group
*/
children?: ReactNode;
/**
* Provide an optional className to be applied to the container node
*/
className?: string;
/**
* Specify the the value of <RadioTile> to be selected by default
*/
defaultSelected?: T;
/**
* Specify whether the group is disabled
*/
disabled?: boolean;
/**
* Provide an optional legend for this group
*/
legend?: string;
/**
* Specify the name of the underlying `<input>` nodes
*/
name: string;
/**
* Provide an optional `onChange` hook that is called whenever the value of the group changes
*/
onChange?: (selection: T, name: string, evt: unknown) => void;
/**
* Specify the value that is currently selected in the group
*/
valueSelected?: T;
/**
* `true` to specify if input selection in group is required.
*/
required?: boolean;
}
export declare const TileGroup: {
<T extends string | number = string>({ children, className, defaultSelected, disabled, legend, name, onChange, valueSelected, required, }: TileGroupProps<T>): import("react/jsx-runtime").JSX.Element;
displayName: string;
propTypes: {
/**
* Provide a collection of <RadioTile> components to render in the group
*/
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
/**
* Provide an optional className to be applied to the container node
*/
className: PropTypes.Requireable<string>;
/**
* Specify the the value of <RadioTile> to be selected by default
*/
defaultSelected: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
/**
* Specify whether the group is disabled
*/
disabled: PropTypes.Requireable<boolean>;
/**
* Provide an optional legend for this group
*/
legend: PropTypes.Requireable<string>;
/**
* Specify the name of the underlying `<input>` nodes
*/
name: PropTypes.Validator<string>;
/**
* Provide an optional `onChange` hook that is called whenever the value of
* the group changes
*/
onChange: PropTypes.Requireable<(...args: any[]) => any>;
/**
* `true` to specify if input selection in group is required.
*/
required: PropTypes.Requireable<boolean>;
/**
* Specify the value that is currently selected in the group
*/
valueSelected: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
};
};
export {};