> ## Documentation Index
> Fetch the complete documentation index at: https://docs.twenty.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MainButton

> Предоставляйте заметные действия с общими настройками дизайна по умолчанию.

## Обзор

Используйте общий компонент `MainButton` для заметного действия. Он объединяет
[Button](https://docs.twenty.com/ru/ui/primitives/input/button.md) со сплошной поверхностью, возвышением, полужирным
текстом и горизонтальными отступами 12px. Его цвет по умолчанию — нейтральный, а размер — `md`.

**Light**

[Пример MainButton (light)](https://storybook.twenty.com/iframe.html?id=ui-components-mainbutton--display\&viewMode=story\&globals=colorScheme:light)

**Dark**

[Пример MainButton (dark)](https://storybook.twenty.com/iframe.html?id=ui-components-mainbutton--display\&viewMode=story\&globals=colorScheme:dark)

[Open in Storybook](https://storybook.twenty.com/?path=/story/ui-components-mainbutton--display)

## Использование

```tsx theme={null}
import { MainButton } from 'twenty-ui/components/input';

export const SaveAction = () => <MainButton>Save changes</MainButton>;
```

## Визуальные параметры

Сравните сплошной и контурный варианты оформления в стандартном и малом размерах, а также в отключенном состоянии и состоянии загрузки.

**Light**

[Варианты и состояния основной кнопки (light)](https://storybook.twenty.com/iframe.html?id=ui-components-mainbutton--catalog\&viewMode=story\&globals=colorScheme:light)

**Dark**

[Варианты и состояния основной кнопки (dark)](https://storybook.twenty.com/iframe.html?id=ui-components-mainbutton--catalog\&viewMode=story\&globals=colorScheme:dark)

[Open in Storybook](https://storybook.twenty.com/?path=/story/ui-components-mainbutton--catalog)

## Управление состоянием

`MainButton` использует модель состояния Button и не добавляет собственного состояния. Ваше приложение предоставляет `loading` и `disabled`; управляемые и неуправляемые режимы выбора отсутствуют. См. [пример управления состоянием Button](https://docs.twenty.com/ru/ui/primitives/input/button.md#state-ownership) для управления асинхронным действием.

## Формы и ширина

```tsx theme={null}
import { MainButton } from 'twenty-ui/components/input';

export const SaveProfile = () => (
  <MainButton type="submit" fullWidth>
    Save profile
  </MainButton>
);
```

Ширина зависит от содержимого, если не задан `fullWidth` или не предоставлена стилизация
макета приложения. При необходимости переопределите `variant`, `color`, `size` и `elevated`;
например, используйте `variant="outline"` и `elevated={false}` для действия с контуром.

При `color="inherit"` явно выберите вариант, отличный от solid, или унаследуйте его от ButtonGroup. Автономный вариант solid по умолчанию с унаследованным цветом вызывает ошибку времени выполнения.

Сохраняйте макет страницы в стилях вашего приложения.

## Взаимодействие

`MainButton` принимает нативные атрибуты Button, обработчики событий, refs, слоты для значков,
свойства `loading` и `disabled`. По умолчанию у кнопок задан `type="button"`;
для отправки формы явно задайте `type="submit"`.

Используйте `href` для ссылки. Передайте `render`, чтобы выбрать пользовательский корневой элемент, включая
ссылку маршрутизатора, принадлежащего приложению. Установите `nativeButton={false}` и `role="link"` для
рендерера навигации. Пользовательские нативные кнопки сохраняют значение `nativeButton` равным true.

[ButtonGroup](https://docs.twenty.com/ru/ui/primitives/input/button-group.md) может задать общий размер, поверхность
и цвет. Явно заданный внешний вид дочернего элемента имеет приоритет над группой, затем
используются значения по умолчанию компонента. Классы потребителя, включая функции состояния, передаются
корневому элементу.

## Свойства

**className** `string | ((state: ButtonState) =\> string | undefined)`

CSS class applied to the element, or a function that
returns a class based on the component's state.

**color** `"accent" | "danger" | "inherit" | "neutral" | "success"`

Semantic color of the button. `inherit` uses the surrounding text color for the label, icons, loader, and outline border, with translucent black interaction surfaces. It supports outline, ghost, soft, and link. Resolving solid with inherit throws, including appearance inherited from ButtonGroup and wrapper defaults.

**elevated** `boolean` (default: true)

Adds a shadow and backdrop blur. Neutral outline buttons also use elevated surface colors.

**endIcon** `ReactNode`

Decorative content displayed after the label.

**focusableWhenDisabled** `boolean` (default: false)

Whether the button should be focusable when disabled.

**fullWidth** `boolean`

Expands the button to fill its container width.

**href** `string`

Destination URL. Renders a native anchor when `render` is omitted unless `nativeButton` is explicitly true. Custom renderers retain their own element contract.

**loading** `boolean`

Shows a loading indicator and disables activation.

**loadingPosition** `"center" | "end" | "start"`

Where the loading indicator appears. `center` hides the content while preserving its layout space; `start` and `end` keep children and the opposite icon visible and replace the corresponding icon with the spinner.

**nativeButton** `boolean` (default: true)

Whether the rendered root is a native button. Defaults to true for custom renderers. The built-in `href` anchor defaults to false; an explicit value takes precedence.

**render** `ReactElement\<unknown, string | JSXElementConstructor\<any\>\> | ComponentRenderFn\<HTMLProps, ButtonState\>`

Caller-supplied root element or renderer. Native attributes, handlers, event details, and refs reach the rendered root. Use `nativeButton={false}` and `role="link"` for a custom navigation anchor. Router integration belongs to the caller.

**role** `AriaRole`

Role of the root element. Use `link` for custom navigation renderers.

**shortcut** `ShortcutDefinition`

Flat key array for simultaneous keys, or nested key arrays for an ordered sequence. Displayed on non-mobile screens.

**shortcutJoinLabel** `string`

Localized text between sequence steps. Defaults to then.

**size** `"md" | "sm"`

Button height: `sm` (24px) or `md` (32px). The `link` variant uses its content height at either size.

**startIcon** `ReactNode`

Decorative content displayed before the label.

**style** `CSSProperties | ((state: ButtonState) =\> CSSProperties | undefined)`

Style applied to the element, or a function that
returns a style object based on the component's state.

**variant** `"ghost" | "link" | "outline" | "soft" | "solid"` (default: solid)

Visual treatment of the button surface. `link` uses compact text styling without a filled surface or border; render composition determines native semantics.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.