diff --git a/CODEOWNERS b/CODEOWNERS
index dd3fceac5c..aa9079d933 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -37,8 +37,8 @@
/src/components/Portal @amje
/src/components/Progress @Lunory
/src/components/Radio @zamkovskaya
-/src/components/RadioButton @zamkovskaya
/src/components/RadioGroup @zamkovskaya
+/src/components/SegmentedRadioGroup @zamkovskaya
/src/components/User @DakEnviy
/src/components/UserLabel @DakEnviy
/src/components/useList @IsaevAlexandr
diff --git a/src/components/RadioButton/README.md b/src/components/RadioButton/README.md
deleted file mode 100644
index 547a8a61e0..0000000000
--- a/src/components/RadioButton/README.md
+++ /dev/null
@@ -1,279 +0,0 @@
-
-
-# RadioButton
-
-
-
-```tsx
-import {RadioButton} from '@gravity-ui/uikit';
-```
-
-The `RadioButton` component is used to create a group of radio buttons where users can select a single option from multiple choices.
-
-### Disabled state
-
-
-
-
-
-```tsx
-const options: RadioButtonOption[] = [
- {value: 'Value 1', content: 'Value 1'},
- {value: 'Value 2', content: 'Value 2'},
- {value: 'Value 3', content: 'Value 3'},
-];
-;
-```
-
-
-
-### Size
-
-To control the size of the `RadioButton`, use the `size` property. The default size is `m`.
-
-
-
-
-
-```tsx
- const options: RadioButtonOption[] = [
- {value: 'Value 1', content: 's'},
- {value: 'Value 2', content: 'm'},
- {value: 'Value 3', content: 'l'},
- {value: 'Value 4', content: 'xl'},
- ];
-
-
-
-
-```
-
-
-
-### Width
-
-To control the width of the `RadioButton`, use the `width` property.
-
-
-
-
-
-```tsx
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-```
-
-
-
-### Properties
-
-| Name | Description | Type | Default |
-| :----------- | :--------------------------------------------------------------------------------------------------- | :-----------------------: | :-----: |
-| children | The content of the radio button. | `ReactNode` | |
-| disabled | Toggles the `disabled` state of the radio button. | `boolean` | `false` |
-| options | Options for radio button. | `RadioButtonOption[]` | |
-| defaultValue | Sets the initial value state when the component is mounted. | `string` | |
-| onUpdate | Fires when the user changes the radio button state. Provides the new value as a callback's argument. | `(value: string) => void` | |
-| onChange | Fires when the user changes the radio button state. Provides change event as a callback's argument. | `Function` | |
-| onFocus | Event handler for when the radio input element receives focus. | `Function` | |
-| onBlur | Event handler for when the radio input element loses focus. | `Function` | |
-| width | Sets the width of the radio button. | `auto - max` | |
-| size | Sets the size of the radio button. | `s` `m` `l` `xl` | `m` |
-| name | HTML `name` attribute for the input element. | `string` | |
-| qa | HTML `data-qa` attribute, used in tests. | `string` | |
-| style | HTML `style` attribute | `React.CSSProperties` | |
-| className | HTML `class` attribute | `string` | |
-
-## RadioButton.Option
-
-The `RadioButton` component also exports a nested `Option` component. You can use it to create radio button options within the `RadioButton`.
-
-
-
-
-
-```tsx
-const options: RadioButtonOption[] = [
- {value: 'Value 1', content: 'Value 1'},
- {value: 'Value 2', content: 'Value 2'},
- {value: 'Value 3', content: 'Value 3'},
-];
-
-
-
-
-;
-```
-
-
-
-### Properties
-
-| Name | Description | Type | Default |
-| :------- | :-------------------------------------------------- | :---------: | :-----: |
-| children | The content of the radio (usually a label). | `ReactNode` | |
-| content | The content of the radio (alternative to children). | `ReactNode` | |
-| disabled | Toggles the `disabled` state of the radio. | `boolean` | `false` |
-| value | Control value | `string` | |
diff --git a/src/components/RadioButton/__stories__/RadioButtonShowcase.tsx b/src/components/RadioButton/__stories__/RadioButtonShowcase.tsx
deleted file mode 100644
index 310e377cd0..0000000000
--- a/src/components/RadioButton/__stories__/RadioButtonShowcase.tsx
+++ /dev/null
@@ -1,90 +0,0 @@
-import React from 'react';
-
-import {CircleInfoFill, TriangleExclamationFill} from '@gravity-ui/icons';
-
-import {Showcase} from '../../../demo/Showcase';
-import {ShowcaseItem} from '../../../demo/ShowcaseItem';
-import {Icon} from '../../Icon';
-import {RadioButton} from '../RadioButton';
-import type {RadioButtonOption} from '../RadioButton';
-
-export function RadioButtonShowcase() {
- const options: RadioButtonOption[] = [
- {value: 'Value 1', content: 'Value 1'},
- {value: 'Value 2', content: 'Value 2'},
- {value: 'Value 3', content: 'Value 3', disabled: true},
- ];
-
- const iconOptions: RadioButtonOption[] = [
- {
- value: 'Value 1',
- content: (
-
-
- Warning
-
- ),
- title: 'Warning',
- },
- {value: 'Value 2', content: , title: 'Info'},
- ];
-
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
s
-
-
-
-
m
-
-
-
-
l
-
-
-
-
xl
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
-}
diff --git a/src/components/RadioButton/index.ts b/src/components/RadioButton/index.ts
deleted file mode 100644
index d813dc5132..0000000000
--- a/src/components/RadioButton/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from './RadioButton';
-// FIXME rename types RadioButtonOption to RadioButtonOptionProps
-export {RadioButtonOption as RadioButtonItem} from './RadioButtonOption';
diff --git a/src/components/SegmentedRadioGroup/README.md b/src/components/SegmentedRadioGroup/README.md
new file mode 100644
index 0000000000..6e6186c1c8
--- /dev/null
+++ b/src/components/SegmentedRadioGroup/README.md
@@ -0,0 +1,263 @@
+
+
+# SegmentedRadioGroup
+
+
+
+```tsx
+import {SegmentedRadioGroup} from '@gravity-ui/uikit';
+```
+
+The `SegmentedRadioGroup` component is used to create a group of radio buttons where users can select a single option from multiple choices.
+
+### Disabled state
+
+
+
+
+
+```tsx
+
+ Value 1
+ Value 2
+ Value 3
+
+```
+
+
+
+### Size
+
+To control the size of the `SegmentedRadioGroup`, use the `size` property. The default size is `m`.
+
+
+
+
+
+```tsx
+const options = [
+Value 1,
+Value 2,
+Value 3,
+];
+
+{options}
+{options}
+{options}
+{options}
+```
+
+
+
+### Width
+
+To control the width of the `SegmentedRadioGroup`, use the `width` property.
+
+
+
+
+
+```tsx
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+
+
+### Properties
+
+| Name | Description | Type | Default |
+| :----------- | :--------------------------------------------------------------------------------------------------- | :---------------------------: | :-----: |
+| children | The content of the radio button. | `ReactNode` | |
+| disabled | Toggles the `disabled` state of the radio button. | `boolean` | `false` |
+| options | Options for radio button. | `SegmentedRadioGroupOption[]` | |
+| defaultValue | Sets the initial value state when the component is mounted. | `string` | |
+| onUpdate | Fires when the user changes the radio button state. Provides the new value as a callback's argument. | `(value: string) => void` | |
+| onChange | Fires when the user changes the radio button state. Provides change event as a callback's argument. | `Function` | |
+| onFocus | Event handler for when the radio input element receives focus. | `Function` | |
+| onBlur | Event handler for when the radio input element loses focus. | `Function` | |
+| width | Sets the width of the radio button. | `auto - max` | |
+| size | Sets the size of the radio button. | `s` `m` `l` `xl` | `m` |
+| name | HTML `name` attribute for the input element. | `string` | |
+| qa | HTML `data-qa` attribute, used in tests. | `string` | |
+| style | HTML `style` attribute | `React.CSSProperties` | |
+| className | HTML `class` attribute | `string` | |
+
+## SegmentedRadioGroup.Option
+
+The `SegmentedRadioGroup` component also exports a nested `Option` component. You can use it to create radio button options within the `SegmentedRadioGroup`.
+
+
+
+
+
+```tsx
+const options: SegmentedRadioGroupOption[] = [
+ {value: 'Value 1', content: 'Value 1'},
+ {value: 'Value 2', content: 'Value 2'},
+ {value: 'Value 3', content: 'Value 3'},
+];
+
+
+
+
+;
+```
+
+
+
+### Properties
+
+| Name | Description | Type | Default |
+| :------- | :-------------------------------------------------- | :---------: | :-----: |
+| children | The content of the radio (usually a label). | `ReactNode` | |
+| content | The content of the radio (alternative to children). | `ReactNode` | |
+| disabled | Toggles the `disabled` state of the radio. | `boolean` | `false` |
+| value | Control value | `string` | |
diff --git a/src/components/RadioButton/RadioButton.scss b/src/components/SegmentedRadioGroup/SegmentedRadioGroup.scss
similarity index 99%
rename from src/components/RadioButton/RadioButton.scss
rename to src/components/SegmentedRadioGroup/SegmentedRadioGroup.scss
index 75461de372..951cde3590 100644
--- a/src/components/RadioButton/RadioButton.scss
+++ b/src/components/SegmentedRadioGroup/SegmentedRadioGroup.scss
@@ -1,6 +1,6 @@
@use '../variables';
-$block: '.#{variables.$ns}radio-button';
+$block: '.#{variables.$ns}segmented-radio-group';
#{$block} {
--_--border-width: 1px;
diff --git a/src/components/RadioButton/RadioButton.tsx b/src/components/SegmentedRadioGroup/SegmentedRadioGroup.tsx
similarity index 61%
rename from src/components/RadioButton/RadioButton.tsx
rename to src/components/SegmentedRadioGroup/SegmentedRadioGroup.tsx
index 573e9ca053..a390fdf843 100644
--- a/src/components/RadioButton/RadioButton.tsx
+++ b/src/components/SegmentedRadioGroup/SegmentedRadioGroup.tsx
@@ -6,35 +6,35 @@ import {useRadioGroup} from '../../hooks/private';
import type {ControlGroupOption, ControlGroupProps, DOMProps, QAProps} from '../types';
import {block} from '../utils/cn';
-import {RadioButtonOption as Option} from './RadioButtonOption';
+import {SegmentedRadioGroupOption as Option} from './SegmentedRadioGroupOption';
-import './RadioButton.scss';
+import './SegmentedRadioGroup.scss';
-const b = block('radio-button');
+const b = block('segmented-radio-group');
-export type RadioButtonOption = ControlGroupOption;
-export type RadioButtonSize = 's' | 'm' | 'l' | 'xl';
-export type RadioButtonWidth = 'auto' | 'max';
+// export type SegmentedRadioGroupOption = ControlGroupOption;
+export type SegmentedRadioGroupSize = 's' | 'm' | 'l' | 'xl';
+export type SegmentedRadioGroupWidth = 'auto' | 'max';
-export interface RadioButtonProps
+export interface SegmentedRadioGroupProps
extends ControlGroupProps,
DOMProps,
QAProps {
- size?: RadioButtonSize;
- width?: RadioButtonWidth;
+ size?: SegmentedRadioGroupSize;
+ width?: SegmentedRadioGroupWidth;
children?:
| React.ReactElement>
| React.ReactElement>[];
}
-type RadioButtonComponentType = ((
- props: RadioButtonProps & {ref?: React.ForwardedRef},
+type SegmentedRadioGroupComponentType = ((
+ props: SegmentedRadioGroupProps & {ref?: React.ForwardedRef},
) => React.JSX.Element) & {
Option: typeof Option;
};
-export const RadioButton = React.forwardRef(function RadioButton(
- props: RadioButtonProps,
+export const SegmentedRadioGroup = React.forwardRef(function SegmentedRadioGroup(
+ props: SegmentedRadioGroupProps,
ref: React.ForwardedRef,
) {
const {size = 'm', width, style, className, qa, children} = props;
@@ -66,6 +66,6 @@ export const RadioButton = React.forwardRef(function RadioButton
);
-}) as unknown as RadioButtonComponentType;
+}) as unknown as SegmentedRadioGroupComponentType;
-RadioButton.Option = Option;
+SegmentedRadioGroup.Option = Option;
diff --git a/src/components/RadioButton/RadioButtonOption.tsx b/src/components/SegmentedRadioGroup/SegmentedRadioGroupOption.tsx
similarity index 63%
rename from src/components/RadioButton/RadioButtonOption.tsx
rename to src/components/SegmentedRadioGroup/SegmentedRadioGroupOption.tsx
index 52019d1562..5c0852634e 100644
--- a/src/components/RadioButton/RadioButtonOption.tsx
+++ b/src/components/SegmentedRadioGroup/SegmentedRadioGroupOption.tsx
@@ -7,23 +7,23 @@ import type {ControlProps} from '../types';
import {block} from '../utils/cn';
import {isIcon, isSvg} from '../utils/common';
-const b = block('radio-button');
+const b = block('segmented-radio-group');
-export interface RadioButtonOptionProps extends ControlProps {
+export interface SegmentedRadioGroupOptionProps
+ extends ControlProps {
value: ValueType;
content?: React.ReactNode;
children?: React.ReactNode;
title?: string;
}
-type RadioButtonOptionComponentType = (
- props: RadioButtonOptionProps,
+type SegmentedRadioGroupOptionComponentType = (
+ props: SegmentedRadioGroupOptionProps,
) => React.JSX.Element;
-export const RadioButtonOption = React.forwardRef(function RadioButtonOption(
- props: RadioButtonOptionProps,
- ref: React.ForwardedRef,
-) {
+export const SegmentedRadioGroupOption = React.forwardRef(function SegmentedRadioGroupOption<
+ T extends string,
+>(props: SegmentedRadioGroupOptionProps, ref: React.ForwardedRef) {
const {disabled = false, content, children, title} = props;
const {checked, inputProps} = useRadio(props);
const inner = content || children;
@@ -42,4 +42,4 @@ export const RadioButtonOption = React.forwardRef(function RadioButtonOption{inner}}
);
-}) as unknown as RadioButtonOptionComponentType;
+}) as unknown as SegmentedRadioGroupOptionComponentType;
diff --git a/src/components/RadioButton/__stories__/Docs.mdx b/src/components/SegmentedRadioGroup/__stories__/Docs.mdx
similarity index 71%
rename from src/components/RadioButton/__stories__/Docs.mdx
rename to src/components/SegmentedRadioGroup/__stories__/Docs.mdx
index 18ac587a0e..fe25897291 100644
--- a/src/components/RadioButton/__stories__/Docs.mdx
+++ b/src/components/SegmentedRadioGroup/__stories__/Docs.mdx
@@ -1,5 +1,5 @@
import {Meta, Markdown} from '@storybook/addon-docs';
-import * as Stories from './RadioButton.stories';
+import * as Stories from './SegmentedRadioGroup.stories';
import Readme from '../README.md?raw';
diff --git a/src/components/RadioButton/__stories__/RadioButton.stories.tsx b/src/components/SegmentedRadioGroup/__stories__/SegmentedRadioGroup.stories.tsx
similarity index 50%
rename from src/components/RadioButton/__stories__/RadioButton.stories.tsx
rename to src/components/SegmentedRadioGroup/__stories__/SegmentedRadioGroup.stories.tsx
index 0725000f48..bc3788610b 100644
--- a/src/components/RadioButton/__stories__/RadioButton.stories.tsx
+++ b/src/components/SegmentedRadioGroup/__stories__/SegmentedRadioGroup.stories.tsx
@@ -4,23 +4,23 @@ import type {Meta, StoryObj} from '@storybook/react';
import {Showcase} from '../../../demo/Showcase';
import {ShowcaseItem} from '../../../demo/ShowcaseItem';
-import {RadioButton} from '../RadioButton';
+import {SegmentedRadioGroup} from '../SegmentedRadioGroup';
-import {RadioButtonShowcase} from './RadioButtonShowcase';
+import {SegmentedRadioGroupShowcase} from './SegmentedRadioGroupShowcase';
export default {
- title: 'Components/Inputs/RadioButton',
- component: RadioButton,
+ title: 'Components/Inputs/SegmentedRadioGroup',
+ component: SegmentedRadioGroup,
} as Meta;
-type Story = StoryObj;
+type Story = StoryObj;
export const Default: Story = {
args: {
- options: [
- {value: 'Value 1', content: 'Value 1'},
- {value: 'Value 2', content: 'Value 2'},
- {value: 'Value 3', content: 'Value 3'},
+ children: [
+ ,
+ ,
+ ,
],
},
};
@@ -29,16 +29,16 @@ export const Size: Story = {
render: (args) => (
-
+
-
+
-
+
-
+
),
@@ -55,6 +55,6 @@ export const Disabled: Story = {
};
export const ShowcaseStory: Story = {
- render: () => ,
+ render: () => ,
name: 'Showcase',
};
diff --git a/src/components/SegmentedRadioGroup/__stories__/SegmentedRadioGroupShowcase.tsx b/src/components/SegmentedRadioGroup/__stories__/SegmentedRadioGroupShowcase.tsx
new file mode 100644
index 0000000000..6ee01a02c6
--- /dev/null
+++ b/src/components/SegmentedRadioGroup/__stories__/SegmentedRadioGroupShowcase.tsx
@@ -0,0 +1,101 @@
+import React from 'react';
+
+import {CircleInfoFill, TriangleExclamationFill} from '@gravity-ui/icons';
+
+import {Showcase} from '../../../demo/Showcase';
+import {ShowcaseItem} from '../../../demo/ShowcaseItem';
+import {Icon} from '../../Icon';
+import {SegmentedRadioGroup} from '../SegmentedRadioGroup';
+
+export function SegmentedRadioGroupShowcase() {
+ const options = [
+
+ Value 1
+ ,
+
+ Value 2
+ ,
+
+ Value 3
+ ,
+ ];
+
+ const iconOptions = [
+
+
+ Warning
+ ,
+
+
+ ,
+ ];
+
+ return (
+
+
+ {options}
+
+
+
+ {iconOptions}
+
+
+
+
+ {options}
+
+
+
+
+