Button

A component that is used for an action on a page.

Interface: IButton.

See the parameters of this component in storybook.

Button

To set the button size, use ButtonSize which can have the following values: extraSmall, small, normal, medium.

Parameters from Storybook

label

The button text.

Type: string

Example: "Convert file"

size

The button size. The normal size is equal to 36x40 px on the Desktop and Touchcreen devices. Can be: extraSmall, small, normal, medium. The default value is extraSmall.

Type: ButtonSize

Example: normal

onClick

Sets a function which specifies an action initiated upon clicking the button.

Type: func

Example: () => {}

primary

Specifies if the button is primary or not. If the button is primary, it is colored blue.

Primary button

Type: boolean

Example: true

scale

Specifies if the button width will be scaled to 100% or not.

Type: boolean

Example: true

isLoading

Specifies if the button will be displayed as a loader icon or not.

Loading button

Type: boolean

Example: true

isDisabled

Specifies if the button is disabled or not. The disabled button is blurred.

Disabled button

Type: boolean

Example: false

Extra parameters

withLoadingAfterClick

Specifies whether to set the isLoading state to the button after it is clicked until the action is completed.

Type: boolean

Example: true

disableWhileRequestRunning

Specifies whether to set the isDisabled state for the button when the withLoadingAfterClick parameter is set to true, and it is clicked either on the page or in the dialog box.

Type: boolean

Example: true

Example

import {ButtonSize, type IButton} from "@onlyoffice/docspace-plugin-sdk"

const buttonProps: IButton = {
  label: "Convert file",
  primary: true,
  size: ButtonSize.normal,
  scale: true,
  isDisabled: false,
  withLoadingAfterClick: true,
  onClick: () => {},
}

Get Help

  • If you have any questions about ONLYOFFICE DocSpace, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).