| Title: | 'Shiny' Bindings for Designsystemet Components |
|---|---|
| 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. |
| Authors: | Novica Nakov [aut, cre, cph] (ORCID: <https://orcid.org/0009-0005-7773-7718>) |
| Maintainer: | Novica Nakov <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.2 |
| Built: | 2026-06-04 17:05:38 UTC |
| Source: | https://github.com/cran/shinyds |
Create an alert message using Designsystemet styles.
ds_alert( ..., variant = c("info", "warning", "danger", "success"), class = NULL )ds_alert( ..., variant = c("info", "warning", "danger", "success"), class = NULL )
... |
Alert content |
variant |
Alert variant ("info", "warning", "danger", "success") |
class |
Additional CSS classes |
A Shiny tag object
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")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")
Create an avatar using Designsystemet styles.
ds_avatar(..., variant = NULL, size = NULL, class = NULL)ds_avatar(..., variant = NULL, size = NULL, class = NULL)
... |
Avatar content (typically an image or initials) |
variant |
Avatar variant |
size |
Size variant ("sm", "md", "lg") |
class |
Additional CSS classes |
A Shiny tag object
ds_avatar("AB", size = "md")ds_avatar("AB", size = "md")
Create a stack of avatars using Designsystemet styles.
ds_avatar_stack(..., class = NULL)ds_avatar_stack(..., class = NULL)
... |
Avatar elements |
class |
Additional CSS classes |
A Shiny tag object
ds_avatar_stack( ds_avatar("AB"), ds_avatar("CD"), ds_avatar("EF") )ds_avatar_stack( ds_avatar("AB"), ds_avatar("CD"), ds_avatar("EF") )
Create a count-indicator badge using Designsystemet styles.
ds_badge( count = NULL, color = NULL, variant = NULL, size = NULL, class = NULL, ... )ds_badge( count = NULL, color = NULL, variant = NULL, size = NULL, class = NULL, ... )
count |
Numeric or character value shown inside the badge circle.
Pass |
color |
Color context: one of |
variant |
Structural variant: |
size |
Size variant ( |
class |
Additional CSS classes. |
... |
Additional attributes passed to the |
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).
A Shiny tag object
# 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")# 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")
Wraps an element so that a ds_badge() can be positioned on top of it.
ds_badge_position(..., placement = "top-right", overlap = NULL, class = NULL)ds_badge_position(..., placement = "top-right", overlap = NULL, class = NULL)
... |
The target element followed by a |
placement |
Badge placement: |
overlap |
Set to |
class |
Additional CSS classes. |
A Shiny tag object
ds_badge_position( ds_button("Inbox"), ds_badge(count = 3, color = "danger"), placement = "top-right" )ds_badge_position( ds_button("Inbox"), ds_badge(count = 3, color = "danger"), placement = "top-right" )
Create a breadcrumb navigation trail.
ds_breadcrumbs(..., class = NULL)ds_breadcrumbs(..., class = NULL)
... |
Child elements (typically list items with links) |
class |
Additional CSS classes |
A Shiny tag object
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")) ) )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")) ) )
Create a styled button using Designsystemet styles.
ds_button( label, inputId = NULL, variant = c("primary", "secondary", "tertiary"), size = NULL, icon = FALSE, loading = FALSE, disabled = FALSE, fullwidth = FALSE, type = "button", ... )ds_button( label, inputId = NULL, variant = c("primary", "secondary", "tertiary"), size = NULL, icon = FALSE, loading = FALSE, disabled = FALSE, fullwidth = FALSE, type = "button", ... )
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 |
A Shiny tag object
ds_button("Click me", inputId = "btn") ds_button("Submit", variant = "primary", type = "submit") ds_button("Cancel", variant = "secondary")ds_button("Click me", inputId = "btn") ds_button("Submit", variant = "primary", type = "submit") ds_button("Cancel", variant = "secondary")
Create a styled card container using Designsystemet styles.
ds_card(..., variant = NULL, class = NULL)ds_card(..., variant = NULL, class = NULL)
... |
Child elements |
variant |
Card variant ("default", "tinted") |
class |
Additional CSS classes |
A Shiny tag object
ds_card( ds_card_block( ds_heading("Card Title", level = 3), ds_paragraph("Card content goes here.") ) )ds_card( ds_card_block( ds_heading("Card Title", level = 3), ds_paragraph("Card content goes here.") ) )
A block section within a card with proper padding.
ds_card_block(..., class = NULL)ds_card_block(..., class = NULL)
... |
Child elements |
class |
Additional CSS classes |
A Shiny tag object
ds_card_block(ds_paragraph("Card content."))ds_card_block(ds_paragraph("Card content."))
Create a styled checkbox using Designsystemet styles.
ds_checkbox(inputId, label, value = FALSE, size = NULL, disabled = FALSE, ...)ds_checkbox(inputId, label, value = FALSE, size = NULL, disabled = FALSE, ...)
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 |
A Shiny tag object
ds_checkbox("agree", "I agree to the terms", value = FALSE)ds_checkbox("agree", "I agree to the terms", value = FALSE)
Create an interactive chip using Designsystemet styles.
ds_chip(..., variant = NULL, size = NULL, selected = FALSE, class = NULL)ds_chip(..., variant = NULL, size = NULL, selected = FALSE, class = NULL)
... |
Chip content |
variant |
Chip variant |
size |
Size variant ("sm", "md", "lg") |
selected |
If TRUE, shows selected state |
class |
Additional CSS classes |
A Shiny tag object
ds_chip("React") ds_chip("Vue", selected = TRUE)ds_chip("React") ds_chip("Vue", selected = TRUE)
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.
ds_combobox(inputId, ..., size = NULL, class = NULL)ds_combobox(inputId, ..., size = NULL, class = NULL)
inputId |
The input slot for Shiny reactivity |
... |
Child elements (input wrapper, options wrapper, etc.) |
size |
Size variant ("sm", "md", "lg") |
class |
Additional CSS classes |
A Shiny tag object
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") )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") )
Returns the HTML dependencies required for Designsystemet components.
ds_dependencies()ds_dependencies()
A list of htmltools htmlDependency objects
ds_dependencies()ds_dependencies()
Create an expandable details section using Designsystemet styles.
ds_details(summary, ..., open = FALSE, class = NULL)ds_details(summary, ..., open = FALSE, class = NULL)
summary |
The summary/title text shown when collapsed |
... |
Content shown when expanded |
open |
If TRUE, the details are initially open |
class |
Additional CSS classes |
A Shiny tag object
ds_details( summary = "Click to expand", ds_paragraph("Hidden content goes here.") )ds_details( summary = "Click to expand", ds_paragraph("Hidden content goes here.") )
Create a modal dialog using Designsystemet styles.
ds_dialog(..., id = NULL, class = NULL)ds_dialog(..., id = NULL, class = NULL)
... |
Dialog content |
id |
Dialog ID for opening/closing |
class |
Additional CSS classes |
A Shiny tag object
ds_dialog( id = "my-dialog", ds_heading("Dialog Title", level = 2), ds_paragraph("Dialog content here."), ds_button("Close", onclick = "this.closest('dialog').close()") )ds_dialog( id = "my-dialog", ds_heading("Dialog Title", level = 2), ds_paragraph("Dialog content here."), ds_button("Close", onclick = "this.closest('dialog').close()") )
Create a horizontal divider using Designsystemet styles.
ds_divider(class = NULL)ds_divider(class = NULL)
class |
Additional CSS classes |
A Shiny tag object
ds_divider()ds_divider()
Create a dropdown menu using Designsystemet styles.
ds_dropdown(trigger, ..., class = NULL)ds_dropdown(trigger, ..., class = NULL)
trigger |
The trigger element (usually a button) |
... |
Dropdown content |
class |
Additional CSS classes |
A Shiny tag object
ds_dropdown( trigger = ds_button("Options"), ds_list(ds_list_item("Edit"), ds_list_item("Delete")) )ds_dropdown( trigger = ds_button("Options"), ds_list(ds_list_item("Edit"), ds_list_item("Delete")) )
Display a summary of form validation errors.
ds_error_summary(..., heading = "Feil i skjema", class = NULL)ds_error_summary(..., heading = "Feil i skjema", class = NULL)
... |
Error list items |
heading |
The heading text for the error summary |
class |
Additional CSS classes |
A Shiny tag object
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")) )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")) )
A container for form field elements with proper spacing and layout.
ds_field(..., size = NULL, class = NULL)ds_field(..., size = NULL, class = NULL)
... |
Child elements (label, input, validation message, etc.) |
size |
Size variant ("sm", "md", "lg") |
class |
Additional CSS classes |
A Shiny tag object
ds_field( ds_label("Email", `for` = "email"), ds_input("email", type = "email", placeholder = "[email protected]"), ds_validation_message("Please enter a valid email") )ds_field( ds_label("Email", `for` = "email"), ds_input("email", type = "email", placeholder = "[email protected]"), ds_validation_message("Please enter a valid email") )
Group related form fields with a legend using Designsystemet styles.
ds_fieldset(legend, ..., class = NULL)ds_fieldset(legend, ..., class = NULL)
legend |
The legend text for the fieldset group |
... |
Child elements (fields, inputs, etc.) |
class |
Additional CSS classes |
A Shiny tag object
ds_fieldset("Preferences", ds_checkbox("opt1", "Option 1"), ds_checkbox("opt2", "Option 2") )ds_fieldset("Preferences", ds_checkbox("opt1", "Option 1"), ds_checkbox("opt2", "Option 2") )
Create a styled heading using Designsystemet styles.
ds_heading(..., level = 2, size = NULL, class = NULL)ds_heading(..., level = 2, size = NULL, class = NULL)
... |
Heading content |
level |
Heading level (1-6) |
size |
Size variant ("2xs", "xs", "sm", "md", "lg", "xl", "2xl") |
class |
Additional CSS classes |
A Shiny tag object
ds_heading("Page Title", level = 1) ds_heading("Section Title", level = 2, size = "lg")ds_heading("Page Title", level = 1) ds_heading("Section Title", level = 2, size = "lg")
Create a styled text input using Designsystemet styles.
ds_input( inputId, value = "", type = "text", placeholder = NULL, size = NULL, readonly = FALSE, disabled = FALSE, invalid = FALSE, ... )ds_input( inputId, value = "", type = "text", placeholder = NULL, size = NULL, readonly = FALSE, disabled = FALSE, invalid = FALSE, ... )
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 |
A Shiny tag object
ds_input("name", placeholder = "Enter your name") ds_input("email", type = "email", placeholder = "[email protected]")ds_input("name", placeholder = "Enter your name") ds_input("email", type = "email", placeholder = "[email protected]")
Create a styled form label using Designsystemet styles.
ds_label(..., `for` = NULL, class = NULL)ds_label(..., `for` = NULL, class = NULL)
... |
Label content |
for |
The ID of the input this label is for |
class |
Additional CSS classes |
A Shiny tag object
ds_label("Email address", `for` = "email")ds_label("Email address", `for` = "email")
Create a styled link using Designsystemet styles.
ds_link(..., href = "#", class = NULL)ds_link(..., href = "#", class = NULL)
... |
Link content |
href |
Link URL |
class |
Additional CSS classes |
A Shiny tag object
ds_link("Visit our website", href = "https://example.com")ds_link("Visit our website", href = "https://example.com")
Create a styled list using Designsystemet styles.
ds_list(..., ordered = FALSE, class = NULL)ds_list(..., ordered = FALSE, class = NULL)
... |
List items |
ordered |
If TRUE, creates an ordered list |
class |
Additional CSS classes |
A Shiny tag object
ds_list( ds_list_item("First item"), ds_list_item("Second item"), ds_list_item("Third item") )ds_list( ds_list_item("First item"), ds_list_item("Second item"), ds_list_item("Third item") )
Create a list item.
ds_list_item(...)ds_list_item(...)
... |
Item content |
A Shiny tag object
ds_list_item("First item")ds_list_item("First item")
Create a pagination component for navigating through pages.
ds_pagination( inputId, current = 1, total, label = "Sidenavigasjon", href = NULL, ... )ds_pagination( inputId, current = 1, total, label = "Sidenavigasjon", href = NULL, ... )
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 |
... |
Additional attributes |
A Shiny tag object
ds_pagination("mypage", current = 1, total = 10)ds_pagination("mypage", current = 1, total = 10)
Create a styled paragraph using Designsystemet styles.
ds_paragraph(..., size = NULL, class = NULL)ds_paragraph(..., size = NULL, class = NULL)
... |
Paragraph content |
size |
Size variant ("sm", "md", "lg") |
class |
Additional CSS classes |
A Shiny tag object
ds_paragraph("This is a paragraph of text.")ds_paragraph("This is a paragraph of text.")
Create a popover using Designsystemet styles.
ds_popover(..., variant = NULL, class = NULL)ds_popover(..., variant = NULL, class = NULL)
... |
Popover content |
variant |
Popover variant ("default", "tinted") |
class |
Additional CSS classes |
A Shiny tag object
ds_popover("Helpful information about this field.") ds_popover("Highlighted note", variant = "tinted")ds_popover("Helpful information about this field.") ds_popover("Highlighted note", variant = "tinted")
Create a styled radio button using Designsystemet styles.
ds_radio( inputId, label, value, name, checked = FALSE, size = NULL, disabled = FALSE, ... )ds_radio( inputId, label, value, name, checked = FALSE, size = NULL, disabled = FALSE, ... )
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 |
A Shiny tag object
ds_radio("opt_a", label = "Option A", value = "a", name = "opts")ds_radio("opt_a", label = "Option A", value = "a", name = "opts")
Create a search input using Designsystemet styles.
ds_search( inputId, value = "", placeholder = "Search...", size = NULL, class = NULL, ... )ds_search( inputId, value = "", placeholder = "Search...", size = NULL, class = NULL, ... )
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 |
A Shiny tag object
ds_search("search", placeholder = "Search...")ds_search("search", placeholder = "Search...")
Create a styled select dropdown using Designsystemet styles.
ds_select( inputId, choices, selected = NULL, size = NULL, disabled = FALSE, ... )ds_select( inputId, choices, selected = NULL, size = NULL, disabled = FALSE, ... )
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 |
A Shiny tag object
ds_select("country", choices = c("Norway" = "no", "Sweden" = "se", "Denmark" = "dk"), selected = "no" )ds_select("country", choices = c("Norway" = "no", "Sweden" = "se", "Denmark" = "dk"), selected = "no" )
Create a loading skeleton placeholder using Designsystemet styles.
ds_skeleton(variant = "text", width = NULL, height = NULL, class = NULL)ds_skeleton(variant = "text", width = NULL, height = NULL, class = NULL)
variant |
Skeleton variant ("text", "circle", "rectangle") |
width |
Width of the skeleton |
height |
Height of the skeleton |
class |
Additional CSS classes |
A Shiny tag object
ds_skeleton(variant = "text", width = "200px") ds_skeleton(variant = "circle", width = "50px", height = "50px")ds_skeleton(variant = "text", width = "200px") ds_skeleton(variant = "circle", width = "50px", height = "50px")
Create an accessibility skip link using Designsystemet styles.
ds_skip_link(..., href = "#main", class = NULL)ds_skip_link(..., href = "#main", class = NULL)
... |
Link content |
href |
Target anchor |
class |
Additional CSS classes |
A Shiny tag object
ds_skip_link("Skip to main content", href = "#main")ds_skip_link("Skip to main content", href = "#main")
Create a loading spinner using Designsystemet styles.
ds_spinner(title = "Laster...", size = NULL, class = NULL)ds_spinner(title = "Laster...", size = NULL, class = NULL)
title |
Accessibility title for the spinner |
size |
Size variant ("sm", "md", "lg") |
class |
Additional CSS classes |
A Shiny tag object
ds_spinner(title = "Loading...")ds_spinner(title = "Loading...")
Create an autocomplete input with suggestions.
ds_suggestion( inputId, choices = NULL, value = "", placeholder = NULL, size = NULL, ... )ds_suggestion( inputId, choices = NULL, value = "", placeholder = NULL, size = NULL, ... )
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 |
A Shiny tag object
ds_suggestion("city", choices = c("Oslo", "Bergen", "Trondheim", "Stavanger"), placeholder = "Search for a city..." )ds_suggestion("city", choices = c("Oslo", "Bergen", "Trondheim", "Stavanger"), placeholder = "Search for a city..." )
A single tab button within ds_tablist.
ds_tab(label, value, selected = FALSE, ...)ds_tab(label, value, selected = FALSE, ...)
label |
The tab label text |
value |
The value to return when this tab is selected |
selected |
Whether this tab is initially selected |
... |
Additional attributes |
A Shiny tag object
ds_tab("Overview", value = "overview", selected = TRUE)ds_tab("Overview", value = "overview", selected = TRUE)
Create a styled table using Designsystemet styles.
ds_table(..., size = NULL, class = NULL)ds_table(..., size = NULL, class = NULL)
... |
Table content (thead, tbody, etc.) |
size |
Size variant ("sm", "md", "lg") |
class |
Additional CSS classes |
A Shiny tag object
ds_table( ds_thead( ds_tr( ds_th("Name"), ds_th("Email") ) ), ds_tbody( ds_tr( ds_td("John Doe"), ds_td("[email protected]") ) ) )ds_table( ds_thead( ds_tr( ds_th("Name"), ds_th("Email") ) ), ds_tbody( ds_tr( ds_td("John Doe"), ds_td("[email protected]") ) ) )
Container for tab buttons within ds_tabs.
ds_tablist(..., class = NULL)ds_tablist(..., class = NULL)
... |
Child elements (ds_tab elements) |
class |
Additional CSS classes |
A Shiny tag object
ds_tablist( ds_tab("First", value = "tab1", selected = TRUE), ds_tab("Second", value = "tab2") )ds_tablist( ds_tab("First", value = "tab1", selected = TRUE), ds_tab("Second", value = "tab2") )
Content panel for a tab.
ds_tabpanel(..., value, class = NULL)ds_tabpanel(..., value, class = NULL)
... |
Panel content |
value |
The value that matches the corresponding ds_tab |
class |
Additional CSS classes |
A Shiny tag object
ds_tabpanel(value = "overview", ds_paragraph("Content here."))ds_tabpanel(value = "overview", ds_paragraph("Content here."))
Create a tabbed interface using Designsystemet tabs.
ds_tabs(inputId, ..., class = NULL)ds_tabs(inputId, ..., class = NULL)
inputId |
The input slot for Shiny reactivity |
... |
Child elements (typically ds_tablist and ds_tabpanel elements) |
class |
Additional CSS classes |
A Shiny tag object
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") )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") )
Create a text label tag using Designsystemet styles.
ds_tag(..., color = NULL, variant = NULL, size = NULL, class = NULL)ds_tag(..., color = NULL, variant = NULL, size = NULL, class = NULL)
... |
Tag content (text or child elements). |
color |
Color context: one of |
variant |
Structural variant: |
size |
Size variant ( |
class |
Additional CSS classes. |
Tags are the right component for standalone text status labels such as
"New", "Beta" or "Active". For numeric count indicators, use
ds_badge.
A Shiny tag object
ds_tag("New") ds_tag("Active", color = "success") ds_tag("Warning", color = "warning", variant = "outline")ds_tag("New") ds_tag("Active", color = "success") ds_tag("Warning", color = "warning", variant = "outline")
Create a table body section.
ds_tbody(...)ds_tbody(...)
... |
Body rows |
A Shiny tag object
ds_tbody(ds_tr(ds_td("John"), ds_td("[email protected]")))ds_tbody(ds_tr(ds_td("John"), ds_td("[email protected]")))
Create a table data cell.
ds_td(...)ds_td(...)
... |
Cell content |
A Shiny tag object
ds_td("Cell content")ds_td("Cell content")
Create a styled textarea using Designsystemet styles.
ds_textarea( inputId, value = "", placeholder = NULL, rows = 3, size = NULL, readonly = FALSE, disabled = FALSE, invalid = FALSE, ... )ds_textarea( inputId, value = "", placeholder = NULL, rows = 3, size = NULL, readonly = FALSE, disabled = FALSE, invalid = FALSE, ... )
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 |
A Shiny tag object
ds_textarea("msg", placeholder = "Type here...", rows = 4)ds_textarea("msg", placeholder = "Type here...", rows = 4)
Create a table header cell.
ds_th(..., scope = "col")ds_th(..., scope = "col")
... |
Cell content |
scope |
Cell scope ("col", "row") |
A Shiny tag object
ds_th("Column header")ds_th("Column header")
Create a table header section.
ds_thead(...)ds_thead(...)
... |
Header rows |
A Shiny tag object
ds_thead(ds_tr(ds_th("Name"), ds_th("Email")))ds_thead(ds_tr(ds_th("Name"), ds_th("Email")))
Create a toggle button group using Designsystemet styles.
ds_toggle_group(inputId, ..., size = NULL, class = NULL)ds_toggle_group(inputId, ..., size = NULL, class = NULL)
inputId |
The input slot for Shiny reactivity |
... |
Toggle buttons |
size |
Size variant ("sm", "md", "lg") |
class |
Additional CSS classes |
A Shiny tag object
## 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)## 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)
Add a tooltip to an element using the data-tooltip attribute.
ds_tooltip(element, text, placement = "top")ds_tooltip(element, text, placement = "top")
element |
The element to attach the tooltip to |
text |
The tooltip text |
placement |
Tooltip placement ("top", "bottom", "left", "right") |
The element with tooltip attributes added
ds_tooltip( ds_button("Hover me"), text = "This is helpful information" )ds_tooltip( ds_button("Hover me"), text = "This is helpful information" )
Create a table row.
ds_tr(...)ds_tr(...)
... |
Row cells |
A Shiny tag object
ds_tr(ds_td("Cell 1"), ds_td("Cell 2"))ds_tr(ds_td("Cell 1"), ds_td("Cell 2"))
Create a validation message using Designsystemet styles.
ds_validation_message(..., variant = "error", class = NULL)ds_validation_message(..., variant = "error", class = NULL)
... |
Message content |
variant |
Message variant ("error", "warning") |
class |
Additional CSS classes |
A Shiny tag object
ds_validation_message("This field is required")ds_validation_message("This field is required")
Change the checked state from the server.
update_ds_checkbox( session = shiny::getDefaultReactiveDomain(), inputId, value = NULL )update_ds_checkbox( session = shiny::getDefaultReactiveDomain(), inputId, value = NULL )
session |
The Shiny session object |
inputId |
The input ID |
value |
The new checked state (TRUE/FALSE) |
Called for its side effect. Returns NULL invisibly.
## Not run: update_ds_checkbox(session, "agree", value = FALSE) ## End(Not run)## Not run: update_ds_checkbox(session, "agree", value = FALSE) ## End(Not run)
Change the value from the server.
update_ds_input( session = shiny::getDefaultReactiveDomain(), inputId, value = NULL )update_ds_input( session = shiny::getDefaultReactiveDomain(), inputId, value = NULL )
session |
The Shiny session object |
inputId |
The input ID |
value |
The new value |
Called for its side effect. Returns NULL invisibly.
## Not run: update_ds_input(session, "name", value = "") ## End(Not run)## Not run: update_ds_input(session, "name", value = "") ## End(Not run)
Change the current page or total pages from the server.
update_ds_pagination( session = shiny::getDefaultReactiveDomain(), inputId, current = NULL, total = NULL )update_ds_pagination( session = shiny::getDefaultReactiveDomain(), inputId, current = NULL, total = NULL )
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 |
Called for its side effect. Returns NULL invisibly.
## Not run: update_ds_pagination(session, "pager", current = 1) ## End(Not run)## Not run: update_ds_pagination(session, "pager", current = 1) ## End(Not run)
Change the selected value or choices from the server.
update_ds_select( session = shiny::getDefaultReactiveDomain(), inputId, value = NULL, choices = NULL )update_ds_select( session = shiny::getDefaultReactiveDomain(), inputId, value = NULL, choices = NULL )
session |
The Shiny session object |
inputId |
The input ID |
value |
The new selected value |
choices |
New named vector of choices |
Called for its side effect. Returns NULL invisibly.
## Not run: update_ds_select(session, "country", value = "no") ## End(Not run)## Not run: update_ds_select(session, "country", value = "no") ## End(Not run)
Change the value or choices from the server.
update_ds_suggestion( session = shiny::getDefaultReactiveDomain(), inputId, value = NULL, choices = NULL )update_ds_suggestion( session = shiny::getDefaultReactiveDomain(), inputId, value = NULL, choices = NULL )
session |
The Shiny session object |
inputId |
The input ID of the suggestion component |
value |
The new value |
choices |
New character vector of choices |
Called for its side effect. Returns NULL invisibly.
## Not run: update_ds_suggestion(session, "fruit", value = "Apple") ## End(Not run)## Not run: update_ds_suggestion(session, "fruit", value = "Apple") ## End(Not run)
Change the selected tab from the server.
update_ds_tabs( session = shiny::getDefaultReactiveDomain(), inputId, selected = NULL )update_ds_tabs( session = shiny::getDefaultReactiveDomain(), inputId, selected = NULL )
session |
The Shiny session object |
inputId |
The input ID of the tabs component |
selected |
The value of the tab to select |
Called for its side effect. Returns NULL invisibly.
## Not run: update_ds_tabs(session, "my_tabs", selected = "overview") ## End(Not run)## Not run: update_ds_tabs(session, "my_tabs", selected = "overview") ## End(Not run)
Include this function in your UI to load all necessary Designsystemet CSS and JavaScript dependencies.
use_designsystemet(color_scheme = "light")use_designsystemet(color_scheme = "light")
color_scheme |
Color scheme to apply to the page. One of |
A tagList containing the dependencies
ui <- bslib::page_fluid( use_designsystemet(), ds_button("Click me", inputId = "btn") )ui <- bslib::page_fluid( use_designsystemet(), ds_button("Click me", inputId = "btn") )