Elements: Dropdown Elements

Description Usage Arguments Details

Description

Basic elements to create dropdown menus in shinyMenus

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
smHeader(label)

smDivider()

smAction(id, label, icon)

smRadio(name, value, label, selected = FALSE)

smCheckbox(name, value, label, selected = FALSE)

smToggle(name, value, label, type = "checkbox", selected = FALSE)

Arguments

label

The label to appear on the element

id

The id of the action element

icon

An optional icon object to add to the element

name

A unique name for the group of elements.

value

The value to return when this element is selected.

selected

Should this element be selected at the start?

type

The type of dropdown element to create.

Details

Use these elements to create custom dropdown menus in your shiny apps. They can be used within standard dropdowns, context menus, navbar dropdowns, or submenus.

smHeader adds a grey, unclickable header to your dropdown menu. Use it help divide your dropdowns into meaningful subsets.

smDivider adds a light, horizontal line to your dropdown menu. It can also help to divide you dropdowns into meaningful subsets.

smAction acts exactly like a native actionButton or actionLink in shiny.

smRadio creates an individual radio dropdown input. When any radio input with the same name attribute is selected by the user, all other elements with the same name will be deselected, and the clicked element will become selected. Reference the smRadio's name attribute to retrieve the value from within your Server logic. For example if name = "foo", then from the server, input$foo would retrieve the value of the currently selected element within the foo group.

You can have more than one smRadio input with the same name and value. Doing so will link these inputs so that if one becomes selected, they will all become selected. This allows you to place options in several places in your shiny app. For example, You could allow the user to change the units of the displayed data from a dropdown in the navbar and from a context menu. These two locations will update based on selections from the other and you will only have to watch one input from your Server logic.

smCheckbox works the same as smRadio but allows for more than one element from a group to be selected at once.

smToggle can create radio or checkbox elements depending on the value of type. smRadio and smCheckbox are actually wrappers for smToggle with type already specified. Create your dropdowns however you like.


ebailey78/shinyMenus documentation built on May 15, 2019, 7:30 p.m.