Skip to contents

Create a styled button using Designsystemet styles. ds_action_button() is a drop-in replacement for shiny::actionButton() with the same (inputId, label, ...) argument order.

Usage

ds_button(
  label,
  inputId = NULL,
  variant = c("primary", "secondary", "tertiary"),
  size = NULL,
  icon = FALSE,
  loading = FALSE,
  disabled = FALSE,
  fullwidth = FALSE,
  type = "button",
  ...
)

ds_action_button(inputId, label, ...)

Arguments

label

The button label.

inputId

Input ID (first argument, matching shiny::actionButton).

variant

Button variant: "primary", "secondary", or "tertiary".

size

Size variant: "sm", "md", or "lg".

icon

If TRUE, creates an icon-only button.

loading

If TRUE, shows loading state.

disabled

If TRUE, disables the button.

fullwidth

If TRUE, makes the button full width.

type

Button type: "button", "submit", or "reset".

...

Additional attributes.

Value

A Shiny tag object.

Examples

ds_button("Click me", inputId = "btn")
#> <button id="btn" class="ds-button ds-action-button" type="button">Click me</button>
ds_button("Submit", variant = "primary", type = "submit")
#> <button class="ds-button" type="submit">Submit</button>
ds_button("Cancel", variant = "secondary")
#> <button class="ds-button" type="button" data-variant="secondary">Cancel</button>
ds_action_button("btn", "Click me")
#> <button id="btn" class="ds-button ds-action-button" type="button">Click me</button>