Skip to content

Block provides a way to organize and group related controls or content.

Overview

Blocks should be used to house content and controls within Panel, most often as part of an application layout comprised of Shell Panels and Shell.

Usage

  • Organize and group controls or interactive elements.
  • Provide consistent spacing, placement, and arrangement of content within a Panel.

Sample

Best Practices

While similar to an Accordion, Blocks are unique in that they are intended to be the primary method of organization within a Panel. Conversely, Accordion can be used to organize non-critical or text-heavy content, outside of a Panel.

Blocks often contain application-specific functionality, controls, or information. While this frequently includes form controls or other interactive elements, it is also appropriate to use a Block to contain static or descriptive text-based content.

Blocks can also be collapsible - when enabled, ensure proper context is provided with the heading and description properties. Additional context can be provided by using an Icon in the icon slot.

Do use one or more Block(s) within Panel to house application controls and interactive elements.
Do make Block collapsible to save space when the content contained is non-critical.
Do make use of heading and description properties to provide context to a user.
Avoid using Block outside of a Panel.
Avoid making Block collapsible when critical information or crucial controls are present.

Accessibility

Keyboard navigation

KeyFunction
EnterToggles the "Expand"/"Collapse" focused component.
SpaceToggles the "Expand"/"Collapse" focused component.
TabMoves focus into/out of the component or moves between calcite-block-sections. If the currently focused step is the last step, focus will leave the component
Tab and ShiftMoves focus into/out of the component or moves between calcite-block-sections. If the currently focused step is the first step, focus will leave the component

API reference

Properties

PropertyAttributeDescriptionTypeDefault
collapsiblecollapsibleWhen true, the component is collapsible.booleanfalse
descriptiondescriptionSpecifies a description for the component. Displays below the heading.string
disableddisabledWhen true, interaction is prevented and the component is displayed with lower opacity.booleanfalse
dragDisableddrag-disabledWhen true, and a parent calcite-block-group is dragEnabled, the component is not draggable.booleanfalse
dragHandledrag-handle
deprecatedin v3.0.0, removal target v6.0.0 - No longer necessary. Use Block Group for draggable functionality.
When true, the component displays a draggable button.
booleanfalse
expandedexpandedWhen true, expands the component and its contents.booleanfalse
headingheadingSpecifies the component's heading text.string
headingLevelheading-levelSpecifies the heading level number of the component's heading for proper document structure, without affecting visual styling.HeadingLevel
iconEndicon-endSpecifies an icon to display at the end of the component.IconName
iconFlipRtlicon-flip-rtlDisplays the iconStart and/or iconEnd as flipped when the element direction is right-to-left ("rtl").FlipContext
iconStarticon-startSpecifies an icon to display at the start of the component.IconName
labellabelSpecifies an accessible label for the component.string
loadingloadingWhen true, a busy indicator is displayed.booleanfalse
menuFlipPlacementsSpecifies the component's fallback menuPlacement when it's initial or specified menuPlacement has insufficient space available.FlipPlacement[]
menuPlacementmenu-placementDetermines where the action menu will be positioned.LogicalPlacement"bottom-end"
messageOverridesOverrides individual strings used by the component.Record<string, unknown> | undefined
openopen
deprecatedin v3.1.0, removal target v6.0.0 - Use the expanded property instead.
When true, expands the component and its contents.
booleanfalse
overlayPositioningoverlay-positioningSpecifies the type of positioning to use for overlaid content, where: "absolute" works for most cases - positioning the component inside of overflowing parent containers, which affects the container's layout, and "fixed" is used to escape an overflowing parent container, or when the reference element's position CSS property is "fixed".OverlayPositioning"absolute"
scalescaleSpecifies the size of the component.Scale"m"
sortHandleOpensort-handle-openWhen true, displays and positions the sort handle.booleanfalse
statusstatus
deprecatedin v3.0.0, removal target v6.0.0 - Use the icon-start property instead.
Displays a status-related indicator icon.
Status
topLayerDisabledtop-layer-disabledWhen true and the component is open, disables top layer placement. Only set this if you need complex z-index control or if top layer placement causes conflicts with third-party components.booleanfalse

Slots

NameDescription
default (unnamed)A slot for adding custom content.
actions-endA slot for adding actionable calcite-action elements after the content of the component. It is recommended to use two or fewer actions.
content-endA slot for adding non-actionable elements after the component's header text.
content-startA slot for adding non-actionable elements before the component's header text.
header-menu-actionsA slot for adding an overflow menu with calcite-actions inside a dropdown menu.

Styles

NameDescription
--calcite-block-border-colorSpecifies the component's border color.
--calcite-block-content-spaceSpecifies the space of the component's default slot.
--calcite-block-header-background-colorSpecifies the component's heading background color.
--calcite-block-header-background-color-hoverSpecifies the component's heading background color when hovered.
--calcite-block-header-background-color-pressSpecifies the component's heading background color when pressed.
--calcite-block-heading-text-colorSpecifies the component's heading text color.
--calcite-block-heading-text-color-press
deprecated use --calcite-block-heading-text-color instead - When the component is expanded, specifies the heading text color.
--calcite-block-padding
deprecated use --calcite-block-content-space instead - Specifies the padding of the component's default slot.
--calcite-block-text-color
deprecated Specifies the component's text color.
--calcite-block-description-text-colorSpecifies the component's description text color.
--calcite-block-icon-colorSpecifies the component's collapsible icon, iconStart and iconEnd color.
--calcite-block-icon-color-hoverSpecifies the component's collapsible icon color when hovered.

Events

NameDescriptionBehavior
calciteBlockBeforeCloseFires when the component is requested to be closed and before the closing transition begins.bubblescomposed
calciteBlockBeforeOpenFires when the component is added to the DOM but not rendered, and before the opening transition begins.bubblescomposed
calciteBlockCloseFires when the component is closed and animation is complete.bubblescomposed
calciteBlockCollapseFires when the component's content area is collapsed.bubblescomposed
calciteBlockExpandFires when the component's content area is expanded.bubblescomposed
calciteBlockOpenFires when the component is open and animation is complete.bubblescomposed
calciteBlockSortHandleBeforeCloseFires when the sort handle is requested to be closed and before the closing transition begins.bubblescomposed
calciteBlockSortHandleBeforeOpenFires when the sort handle is added to the DOM but not rendered, and before the opening transition begins.bubblescomposed
calciteBlockSortHandleCloseFires when the sort handle is closed and animation is complete.bubblescomposed
calciteBlockSortHandleOpenFires when the sort handle is open and animation is complete.bubblescomposed
calciteBlockToggle
deprecatedin v3.0.0, removal target v6.0.0 - Use openClose events such as calciteBlockOpen, calciteBlockClose, calciteBlockBeforeOpen, and calciteBlockBeforeClose instead.
Fires when the component's header is clicked.
bubblescomposed

Methods

NameDescriptionSignature
componentOnReadyCreate a promise that resolves once component is fully loaded.componentOnReady(): Promise<this>
setFocusSets focus on the component's first tabbable element.setFocus(options?: FocusOptions): Promise<void>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.