Creates a collapsible block component designed to house content and controls within a Panel, most often as part of an application layout with Shell Panels.
calcite_block(
...,
id = NULL,
heading = NULL,
description = NULL,
collapsible = TRUE,
expanded = TRUE,
disabled = NULL,
loading = NULL,
icon_start = NULL,
icon_end = NULL,
icon_flip_rtl = NULL,
scale = NULL,
heading_level = NULL,
label = NULL,
drag_disabled = NULL,
sort_handle_open = NULL,
menu_placement = NULL,
overlay_positioning = NULL
)An object of class calcite_component
Child content for the block
Component ID (required for Shiny reactivity)
Header text for the block
Description text displayed below the heading
Whether the block can be collapsed (default: FALSE)
Whether the block is currently expanded (default: FALSE)
Whether interaction is prevented (default: FALSE)
Whether to display a busy indicator (default: FALSE)
Icon to display at the start of the header
Icon to display at the end of the header
Flip icons in RTL languages: "start", "end", or "both"
Size of the component: "s" (small), "m" (medium), or "l" (large)
Semantic heading level (1-6) for accessibility
Accessible name for the component
Prevent dragging when parent Block Group enables it (default: FALSE)
Display and position the sort handle (default: FALSE)
Placement of the action menu
Positioning type for overlaid content: "absolute" or "fixed"
The block emits events when it's expanded or collapsed, making it easy to track state.
Available properties in input$id:
$expanded - Whether the block is currently expanded
$collapsible - Whether the block is collapsible
$disabled - Whether the block is disabled
$heading - The heading text
Other component properties
Basic usage:
calcite_block(
id = "my_block",
heading = "Layer effects",
description = "Adjust blur, highlight, and more",
collapsible = TRUE,
expanded = TRUE,
icon_start = "effects",
# Block content...
)# In server
observeEvent(input$my_block$expanded, {
if (input$my_block$expanded) {
message("Block was expanded")
} else {
message("Block was collapsed")
}
})
Update from server:
# Programmatically expand or collapse the block
update_calcite("my_block", expanded = TRUE)
update_calcite("my_block", expanded = FALSE)
# Basic collapsible block
calcite_block(
id = "effects_block",
heading = "Layer effects",
description = "Adjust blur, highlight, and more",
collapsible = TRUE,
icon_start = "effects",
"Block content goes here..."
)
Run the code above in your browser using DataLab