Package {shinyds}


Title: 'Shiny' Bindings for Designsystemet Components
Version: 0.2.2
Description: Provides 'R' wrappers for the Designsystemet component library https://designsystemet.no, enabling use of Norwegian government design system components in Shiny applications. Includes web components and CSS-based HTML components with full Shiny input binding support.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 8.0.0
Imports: htmltools (≥ 0.5.0), shiny (≥ 1.7.0)
Suggests: testthat (≥ 3.0.0), shinytest2, chromote, jsonlite, withr, bslib, quarto
VignetteBuilder: quarto
Config/testthat/edition: 3
Config/roxygen2/markdown: TRUE
Config/roxygen2/version: 8.0.0
URL: https://github.com/novica/shinyds
BugReports: https://github.com/novica/shinyds/issues
NeedsCompilation: no
Packaged: 2026-05-31 18:16:12 UTC; novica
Author: Novica Nakov ORCID iD [aut, cre, cph]
Maintainer: Novica Nakov <nnovica@gmail.com>
Repository: CRAN
Date/Publication: 2026-06-04 12:20:02 UTC

Internal: Combine class names

Description

Internal: Combine class names

Usage

.ds_classes(...)

Arguments

...

Class names (can be NULL)


Alert Component

Description

Create an alert message using Designsystemet styles.

Usage

ds_alert(
  ...,
  variant = c("info", "warning", "danger", "success"),
  class = NULL
)

Arguments

...

Alert content

variant

Alert variant ("info", "warning", "danger", "success")

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_alert("This is an informational message.", variant = "info")
ds_alert("Warning: Please review before continuing.", variant = "warning")
ds_alert("Error: Something went wrong.", variant = "danger")
ds_alert("Success! Your changes were saved.", variant = "success")

Avatar Component

Description

Create an avatar using Designsystemet styles.

Usage

ds_avatar(..., variant = NULL, size = NULL, class = NULL)

Arguments

...

Avatar content (typically an image or initials)

variant

Avatar variant

size

Size variant ("sm", "md", "lg")

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_avatar("AB", size = "md")

Avatar Stack Component

Description

Create a stack of avatars using Designsystemet styles.

Usage

ds_avatar_stack(..., class = NULL)

Arguments

...

Avatar elements

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_avatar_stack(
  ds_avatar("AB"),
  ds_avatar("CD"),
  ds_avatar("EF")
)

Badge Component

Description

Create a count-indicator badge using Designsystemet styles.

Usage

ds_badge(
  count = NULL,
  color = NULL,
  variant = NULL,
  size = NULL,
  class = NULL,
  ...
)

Arguments

count

Numeric or character value shown inside the badge circle. Pass NULL for a plain dot.

color

Color context: one of "info", "success", "warning", "danger", "accent", "neutral", "brand1", "brand2". Maps to the DS data-color attribute.

variant

Structural variant: "tinted" for a muted background. Colour variants belong in color, not here.

size

Size variant ("sm", "md", "lg").

class

Additional CSS classes.

...

Additional attributes passed to the <span>.

Details

The badge is a small circle that sits on top of another element (e.g. a button) to show a numeric count. Wrap the target element with a ds_badge_position() container and place ds_badge() inside it.

The circle text comes from count; ... is the accessible label for the element being badged (rendered as invisible span text).

Value

A Shiny tag object

Examples

# Count badge on a button (typical use)
htmltools::tags$span(
  class = "ds-badge--position",
  ds_button("Inbox"),
  ds_badge(count = 4, color = "danger")
)

# Standalone dot with no count
ds_badge(color = "success")

Badge Position Wrapper

Description

Wraps an element so that a ds_badge() can be positioned on top of it.

Usage

ds_badge_position(..., placement = "top-right", overlap = NULL, class = NULL)

Arguments

...

The target element followed by a ds_badge().

placement

Badge placement: "top-right" (default), "top-left", "bottom-right", "bottom-left".

overlap

Set to "circle" when the target is a circular avatar.

class

Additional CSS classes.

Value

A Shiny tag object

Examples

ds_badge_position(
  ds_button("Inbox"),
  ds_badge(count = 3, color = "danger"),
  placement = "top-right"
)

Breadcrumbs Component

Description

Create a breadcrumb navigation trail.

Usage

ds_breadcrumbs(..., class = NULL)

Arguments

...

Child elements (typically list items with links)

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_breadcrumbs(
  htmltools::tags$ol(
    htmltools::tags$li(ds_link("Home", href = "/")),
    htmltools::tags$li(ds_link("Products", href = "/products")),
    htmltools::tags$li(htmltools::tags$span("Current Page"))
  )
)

Button Component

Description

Create a styled button using Designsystemet styles.

Usage

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

Arguments

label

The button label

inputId

Optional input ID for Shiny reactivity (creates action button)

variant

Button variant ("primary", "secondary", "tertiary")

size

Size variant ("sm", "md", "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", "reset")

...

Additional attributes

Value

A Shiny tag object

Examples

ds_button("Click me", inputId = "btn")
ds_button("Submit", variant = "primary", type = "submit")
ds_button("Cancel", variant = "secondary")

Card Component

Description

Create a styled card container using Designsystemet styles.

Usage

ds_card(..., variant = NULL, class = NULL)

Arguments

...

Child elements

variant

Card variant ("default", "tinted")

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_card(
  ds_card_block(
    ds_heading("Card Title", level = 3),
    ds_paragraph("Card content goes here.")
  )
)

Card Block

Description

A block section within a card with proper padding.

Usage

ds_card_block(..., class = NULL)

Arguments

...

Child elements

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_card_block(ds_paragraph("Card content."))

Checkbox Component

Description

Create a styled checkbox using Designsystemet styles.

Usage

ds_checkbox(inputId, label, value = FALSE, size = NULL, disabled = FALSE, ...)

Arguments

inputId

The input slot for Shiny reactivity

label

The checkbox label

value

Initial checked state

size

Size variant ("sm", "md", "lg")

disabled

If TRUE, disables the checkbox

...

Additional attributes

Value

A Shiny tag object

Examples

ds_checkbox("agree", "I agree to the terms", value = FALSE)

Chip Component

Description

Create an interactive chip using Designsystemet styles.

Usage

ds_chip(..., variant = NULL, size = NULL, selected = FALSE, class = NULL)

Arguments

...

Chip content

variant

Chip variant

size

Size variant ("sm", "md", "lg")

selected

If TRUE, shows selected state

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_chip("React")
ds_chip("Vue", selected = TRUE)

Combobox Component

Description

Create a combobox container using Designsystemet styles. Unlike ds_suggestion, this is a pure CSS component — keyboard navigation and dropdown behaviour must be implemented by the caller.

Usage

ds_combobox(inputId, ..., size = NULL, class = NULL)

Arguments

inputId

The input slot for Shiny reactivity

...

Child elements (input wrapper, options wrapper, etc.)

size

Size variant ("sm", "md", "lg")

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_combobox("mycombo",
  htmltools::tags$div(class = "ds-combobox__input__wrapper",
    htmltools::tags$input(class = "ds-combobox__input", type = "text")
  ),
  htmltools::tags$div(class = "ds-combobox__options-wrapper")
)

Designsystemet Dependencies

Description

Returns the HTML dependencies required for Designsystemet components.

Usage

ds_dependencies()

Value

A list of htmltools htmlDependency objects

Examples

ds_dependencies()

Details/Accordion Component

Description

Create an expandable details section using Designsystemet styles.

Usage

ds_details(summary, ..., open = FALSE, class = NULL)

Arguments

summary

The summary/title text shown when collapsed

...

Content shown when expanded

open

If TRUE, the details are initially open

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_details(
  summary = "Click to expand",
  ds_paragraph("Hidden content goes here.")
)

Dialog Component

Description

Create a modal dialog using Designsystemet styles.

Usage

ds_dialog(..., id = NULL, class = NULL)

Arguments

...

Dialog content

id

Dialog ID for opening/closing

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_dialog(
  id = "my-dialog",
  ds_heading("Dialog Title", level = 2),
  ds_paragraph("Dialog content here."),
  ds_button("Close", onclick = "this.closest('dialog').close()")
)

Divider Component

Description

Create a horizontal divider using Designsystemet styles.

Usage

ds_divider(class = NULL)

Arguments

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_divider()

Dropdown Component

Description

Create a dropdown menu using Designsystemet styles.

Usage

ds_dropdown(trigger, ..., class = NULL)

Arguments

trigger

The trigger element (usually a button)

...

Dropdown content

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_dropdown(
  trigger = ds_button("Options"),
  ds_list(ds_list_item("Edit"), ds_list_item("Delete"))
)

Error Summary Component

Description

Display a summary of form validation errors.

Usage

ds_error_summary(..., heading = "Feil i skjema", class = NULL)

Arguments

...

Error list items

heading

The heading text for the error summary

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_error_summary(
  heading = "There were errors in the form",
  htmltools::tags$li(ds_link("Name is required", href = "#name")),
  htmltools::tags$li(ds_link("Email is invalid", href = "#email"))
)

Field Container

Description

A container for form field elements with proper spacing and layout.

Usage

ds_field(..., size = NULL, class = NULL)

Arguments

...

Child elements (label, input, validation message, etc.)

size

Size variant ("sm", "md", "lg")

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_field(
  ds_label("Email", `for` = "email"),
  ds_input("email", type = "email", placeholder = "your@email.com"),
  ds_validation_message("Please enter a valid email")
)

Fieldset Component

Description

Group related form fields with a legend using Designsystemet styles.

Usage

ds_fieldset(legend, ..., class = NULL)

Arguments

legend

The legend text for the fieldset group

...

Child elements (fields, inputs, etc.)

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_fieldset("Preferences",
  ds_checkbox("opt1", "Option 1"),
  ds_checkbox("opt2", "Option 2")
)

Heading Component

Description

Create a styled heading using Designsystemet styles.

Usage

ds_heading(..., level = 2, size = NULL, class = NULL)

Arguments

...

Heading content

level

Heading level (1-6)

size

Size variant ("2xs", "xs", "sm", "md", "lg", "xl", "2xl")

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_heading("Page Title", level = 1)
ds_heading("Section Title", level = 2, size = "lg")

Text Input Component

Description

Create a styled text input using Designsystemet styles.

Usage

ds_input(
  inputId,
  value = "",
  type = "text",
  placeholder = NULL,
  size = NULL,
  readonly = FALSE,
  disabled = FALSE,
  invalid = FALSE,
  ...
)

Arguments

inputId

The input slot for Shiny reactivity

value

Initial value

type

Input type ("text", "email", "password", "number", "tel", "url")

placeholder

Placeholder text

size

Size variant ("sm", "md", "lg")

readonly

If TRUE, makes the input read-only

disabled

If TRUE, disables the input

invalid

If TRUE, shows invalid state

...

Additional attributes

Value

A Shiny tag object

Examples

ds_input("name", placeholder = "Enter your name")
ds_input("email", type = "email", placeholder = "your@email.com")

Label Component

Description

Create a styled form label using Designsystemet styles.

Usage

ds_label(..., `for` = NULL, class = NULL)

Arguments

...

Label content

for

The ID of the input this label is for

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_label("Email address", `for` = "email")

Description

Create a styled link using Designsystemet styles.

Usage

ds_link(..., href = "#", class = NULL)

Arguments

...

Link content

href

Link URL

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_link("Visit our website", href = "https://example.com")

List Component

Description

Create a styled list using Designsystemet styles.

Usage

ds_list(..., ordered = FALSE, class = NULL)

Arguments

...

List items

ordered

If TRUE, creates an ordered list

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_list(
  ds_list_item("First item"),
  ds_list_item("Second item"),
  ds_list_item("Third item")
)

List Item

Description

Create a list item.

Usage

ds_list_item(...)

Arguments

...

Item content

Value

A Shiny tag object

Examples

ds_list_item("First item")

Pagination Component

Description

Create a pagination component for navigating through pages.

Usage

ds_pagination(
  inputId,
  current = 1,
  total,
  label = "Sidenavigasjon",
  href = NULL,
  ...
)

Arguments

inputId

The input slot for Shiny reactivity

current

The current page number (1-indexed)

total

The total number of pages

label

Accessibility label for the pagination nav

href

Optional URL template for page links (use sprintf style, e.g. "page?p=1")

...

Additional attributes

Value

A Shiny tag object

Examples

ds_pagination("mypage", current = 1, total = 10)

Paragraph Component

Description

Create a styled paragraph using Designsystemet styles.

Usage

ds_paragraph(..., size = NULL, class = NULL)

Arguments

...

Paragraph content

size

Size variant ("sm", "md", "lg")

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_paragraph("This is a paragraph of text.")

Popover Component

Description

Create a popover using Designsystemet styles.

Usage

ds_popover(..., variant = NULL, class = NULL)

Arguments

...

Popover content

variant

Popover variant ("default", "tinted")

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_popover("Helpful information about this field.")
ds_popover("Highlighted note", variant = "tinted")

Radio Button Component

Description

Create a styled radio button using Designsystemet styles.

Usage

ds_radio(
  inputId,
  label,
  value,
  name,
  checked = FALSE,
  size = NULL,
  disabled = FALSE,
  ...
)

Arguments

inputId

The input slot for Shiny reactivity

label

The radio button label

value

The value for this radio button

name

The name grouping radio buttons together

checked

If TRUE, this radio is initially selected

size

Size variant ("sm", "md", "lg")

disabled

If TRUE, disables the radio button

...

Additional attributes

Value

A Shiny tag object

Examples

ds_radio("opt_a", label = "Option A", value = "a", name = "opts")

Description

Create a search input using Designsystemet styles.

Usage

ds_search(
  inputId,
  value = "",
  placeholder = "Search...",
  size = NULL,
  class = NULL,
  ...
)

Arguments

inputId

The input slot for Shiny reactivity

value

Initial value

placeholder

Placeholder text

size

Size variant ("sm", "md", "lg")

class

Additional CSS classes

...

Additional attributes

Value

A Shiny tag object

Examples

ds_search("search", placeholder = "Search...")

Select Component

Description

Create a styled select dropdown using Designsystemet styles.

Usage

ds_select(
  inputId,
  choices,
  selected = NULL,
  size = NULL,
  disabled = FALSE,
  ...
)

Arguments

inputId

The input slot for Shiny reactivity

choices

Named vector of choices (names are labels, values are values)

selected

Initially selected value

size

Size variant ("sm", "md", "lg")

disabled

If TRUE, disables the select

...

Additional attributes

Value

A Shiny tag object

Examples

ds_select("country",
  choices = c("Norway" = "no", "Sweden" = "se", "Denmark" = "dk"),
  selected = "no"
)

Skeleton Component

Description

Create a loading skeleton placeholder using Designsystemet styles.

Usage

ds_skeleton(variant = "text", width = NULL, height = NULL, class = NULL)

Arguments

variant

Skeleton variant ("text", "circle", "rectangle")

width

Width of the skeleton

height

Height of the skeleton

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_skeleton(variant = "text", width = "200px")
ds_skeleton(variant = "circle", width = "50px", height = "50px")

Description

Create an accessibility skip link using Designsystemet styles.

Usage

ds_skip_link(..., href = "#main", class = NULL)

Arguments

...

Link content

href

Target anchor

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_skip_link("Skip to main content", href = "#main")

Spinner Component

Description

Create a loading spinner using Designsystemet styles.

Usage

ds_spinner(title = "Laster...", size = NULL, class = NULL)

Arguments

title

Accessibility title for the spinner

size

Size variant ("sm", "md", "lg")

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_spinner(title = "Loading...")

Suggestion/Autocomplete Component

Description

Create an autocomplete input with suggestions.

Usage

ds_suggestion(
  inputId,
  choices = NULL,
  value = "",
  placeholder = NULL,
  size = NULL,
  ...
)

Arguments

inputId

The input slot for Shiny reactivity

choices

Character vector of suggestion choices

value

Initial value

placeholder

Placeholder text

size

Size variant ("sm", "md", "lg")

...

Additional attributes

Value

A Shiny tag object

Examples

ds_suggestion("city",
  choices = c("Oslo", "Bergen", "Trondheim", "Stavanger"),
  placeholder = "Search for a city..."
)

Tab Button

Description

A single tab button within ds_tablist.

Usage

ds_tab(label, value, selected = FALSE, ...)

Arguments

label

The tab label text

value

The value to return when this tab is selected

selected

Whether this tab is initially selected

...

Additional attributes

Value

A Shiny tag object

Examples

ds_tab("Overview", value = "overview", selected = TRUE)

Table Component

Description

Create a styled table using Designsystemet styles.

Usage

ds_table(..., size = NULL, class = NULL)

Arguments

...

Table content (thead, tbody, etc.)

size

Size variant ("sm", "md", "lg")

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_table(
  ds_thead(
    ds_tr(
      ds_th("Name"),
      ds_th("Email")
    )
  ),
  ds_tbody(
    ds_tr(
      ds_td("John Doe"),
      ds_td("john@example.com")
    )
  )
)

Tab List Container

Description

Container for tab buttons within ds_tabs.

Usage

ds_tablist(..., class = NULL)

Arguments

...

Child elements (ds_tab elements)

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_tablist(
  ds_tab("First", value = "tab1", selected = TRUE),
  ds_tab("Second", value = "tab2")
)

Tab Panel

Description

Content panel for a tab.

Usage

ds_tabpanel(..., value, class = NULL)

Arguments

...

Panel content

value

The value that matches the corresponding ds_tab

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_tabpanel(value = "overview", ds_paragraph("Content here."))

Tabs Component

Description

Create a tabbed interface using Designsystemet tabs.

Usage

ds_tabs(inputId, ..., class = NULL)

Arguments

inputId

The input slot for Shiny reactivity

...

Child elements (typically ds_tablist and ds_tabpanel elements)

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_tabs("mytabs",
  ds_tablist(
    ds_tab("First", value = "tab1", selected = TRUE),
    ds_tab("Second", value = "tab2")
  ),
  ds_tabpanel(value = "tab1", "Content 1"),
  ds_tabpanel(value = "tab2", "Content 2")
)

Tag Component

Description

Create a text label tag using Designsystemet styles.

Usage

ds_tag(..., color = NULL, variant = NULL, size = NULL, class = NULL)

Arguments

...

Tag content (text or child elements).

color

Color context: one of "info", "success", "warning", "danger", "accent", "neutral", "brand1", "brand2". Maps to the DS data-color attribute.

variant

Structural variant: "outline" adds a subtle border.

size

Size variant ("sm", "md", "lg").

class

Additional CSS classes.

Details

Tags are the right component for standalone text status labels such as "New", "Beta" or "Active". For numeric count indicators, use ds_badge.

Value

A Shiny tag object

Examples

ds_tag("New")
ds_tag("Active",  color = "success")
ds_tag("Warning", color = "warning", variant = "outline")

Table Body

Description

Create a table body section.

Usage

ds_tbody(...)

Arguments

...

Body rows

Value

A Shiny tag object

Examples

ds_tbody(ds_tr(ds_td("John"), ds_td("john@example.com")))

Table Data Cell

Description

Create a table data cell.

Usage

ds_td(...)

Arguments

...

Cell content

Value

A Shiny tag object

Examples

ds_td("Cell content")

Textarea Component

Description

Create a styled textarea using Designsystemet styles.

Usage

ds_textarea(
  inputId,
  value = "",
  placeholder = NULL,
  rows = 3,
  size = NULL,
  readonly = FALSE,
  disabled = FALSE,
  invalid = FALSE,
  ...
)

Arguments

inputId

The input slot for Shiny reactivity

value

Initial value

placeholder

Placeholder text

rows

Number of visible rows

size

Size variant ("sm", "md", "lg")

readonly

If TRUE, makes the textarea read-only

disabled

If TRUE, disables the textarea

invalid

If TRUE, shows invalid state

...

Additional attributes

Value

A Shiny tag object

Examples

ds_textarea("msg", placeholder = "Type here...", rows = 4)

Table Header Cell

Description

Create a table header cell.

Usage

ds_th(..., scope = "col")

Arguments

...

Cell content

scope

Cell scope ("col", "row")

Value

A Shiny tag object

Examples

ds_th("Column header")

Table Header

Description

Create a table header section.

Usage

ds_thead(...)

Arguments

...

Header rows

Value

A Shiny tag object

Examples

ds_thead(ds_tr(ds_th("Name"), ds_th("Email")))

Toggle Group Component

Description

Create a toggle button group using Designsystemet styles.

Usage

ds_toggle_group(inputId, ..., size = NULL, class = NULL)

Arguments

inputId

The input slot for Shiny reactivity

...

Toggle buttons

size

Size variant ("sm", "md", "lg")

class

Additional CSS classes

Value

A Shiny tag object

Examples

## Not run: 
ds_toggle_group(
  "view_mode",
  tags$button(class = "ds-button", `data-variant` = "secondary",
              `aria-pressed` = "true",  value = "list", "List"),
  tags$button(class = "ds-button", `data-variant` = "secondary",
              `aria-pressed` = "false", value = "grid", "Grid")
)

## End(Not run)

Tooltip

Description

Add a tooltip to an element using the data-tooltip attribute.

Usage

ds_tooltip(element, text, placement = "top")

Arguments

element

The element to attach the tooltip to

text

The tooltip text

placement

Tooltip placement ("top", "bottom", "left", "right")

Value

The element with tooltip attributes added

Examples

ds_tooltip(
  ds_button("Hover me"),
  text = "This is helpful information"
)

Table Row

Description

Create a table row.

Usage

ds_tr(...)

Arguments

...

Row cells

Value

A Shiny tag object

Examples

ds_tr(ds_td("Cell 1"), ds_td("Cell 2"))

Validation Message Component

Description

Create a validation message using Designsystemet styles.

Usage

ds_validation_message(..., variant = "error", class = NULL)

Arguments

...

Message content

variant

Message variant ("error", "warning")

class

Additional CSS classes

Value

A Shiny tag object

Examples

ds_validation_message("This field is required")

Update Checkbox

Description

Change the checked state from the server.

Usage

update_ds_checkbox(
  session = shiny::getDefaultReactiveDomain(),
  inputId,
  value = NULL
)

Arguments

session

The Shiny session object

inputId

The input ID

value

The new checked state (TRUE/FALSE)

Value

Called for its side effect. Returns NULL invisibly.

Examples

## Not run: 
update_ds_checkbox(session, "agree", value = FALSE)

## End(Not run)

Update Text Input

Description

Change the value from the server.

Usage

update_ds_input(
  session = shiny::getDefaultReactiveDomain(),
  inputId,
  value = NULL
)

Arguments

session

The Shiny session object

inputId

The input ID

value

The new value

Value

Called for its side effect. Returns NULL invisibly.

Examples

## Not run: 
update_ds_input(session, "name", value = "")

## End(Not run)

Update Pagination Input

Description

Change the current page or total pages from the server.

Usage

update_ds_pagination(
  session = shiny::getDefaultReactiveDomain(),
  inputId,
  current = NULL,
  total = NULL
)

Arguments

session

The Shiny session object

inputId

The input ID of the pagination component

current

The new current page number

total

The new total number of pages

Value

Called for its side effect. Returns NULL invisibly.

Examples

## Not run: 
update_ds_pagination(session, "pager", current = 1)

## End(Not run)

Update Select

Description

Change the selected value or choices from the server.

Usage

update_ds_select(
  session = shiny::getDefaultReactiveDomain(),
  inputId,
  value = NULL,
  choices = NULL
)

Arguments

session

The Shiny session object

inputId

The input ID

value

The new selected value

choices

New named vector of choices

Value

Called for its side effect. Returns NULL invisibly.

Examples

## Not run: 
update_ds_select(session, "country", value = "no")

## End(Not run)

Update Suggestion Input

Description

Change the value or choices from the server.

Usage

update_ds_suggestion(
  session = shiny::getDefaultReactiveDomain(),
  inputId,
  value = NULL,
  choices = NULL
)

Arguments

session

The Shiny session object

inputId

The input ID of the suggestion component

value

The new value

choices

New character vector of choices

Value

Called for its side effect. Returns NULL invisibly.

Examples

## Not run: 
update_ds_suggestion(session, "fruit", value = "Apple")

## End(Not run)

Update Tabs Input

Description

Change the selected tab from the server.

Usage

update_ds_tabs(
  session = shiny::getDefaultReactiveDomain(),
  inputId,
  selected = NULL
)

Arguments

session

The Shiny session object

inputId

The input ID of the tabs component

selected

The value of the tab to select

Value

Called for its side effect. Returns NULL invisibly.

Examples

## Not run: 
update_ds_tabs(session, "my_tabs", selected = "overview")

## End(Not run)

Use Designsystemet in a Shiny App

Description

Include this function in your UI to load all necessary Designsystemet CSS and JavaScript dependencies.

Usage

use_designsystemet(color_scheme = "light")

Arguments

color_scheme

Color scheme to apply to the page. One of "light" or "dark". Sets the data-color-scheme attribute on ⁠<html>⁠, which activates Designsystemet's CSS custom property tokens.

Value

A tagList containing the dependencies

Examples

ui <- bslib::page_fluid(
  use_designsystemet(),
  ds_button("Click me", inputId = "btn")
)