Components
Our reference for the ContentKit covers all the objects you will receive and respond with, alongside all the components you can use in order to render the UI for your integrations.
If you want to learn more about the ContentKit itself, alongside the different types of requests we make in order to make these work, please take a look at our introduction.
Components are divided into 3 different categories:
Layout: Components for structuring your integration
Display: Visual components for representing data and media
Interactive: Interactive components
Layout
block
block
Top level component for a custom block.
children
*
Array<Block>
Content to display in the block.
controls
Array<BlockControl>
Control menu items displayed for the block.
controls.icon
The icon to display with the control
controls.label
string
The label for the control
controls.confirm
object
Modal object to display to ask the user to confirm the action before execution
controls.confirm.title
string
Title for the confirmation button
controls.confirm.text
string
Content for the confirmation button
controls.confirm.confirm
string
Label for the confirmation button
controls.confirm.style
"primary"
| "danger"
Style for the confirmation button.
*required
vstack
vstack
Flex layout element to render a vertical stack of elements. Use spacer
, divider
, and box
to complete the layout.
children
*
Array<Block>
Content to display in the stack.
align
'start' | 'center' | 'end'
Horizontal alignment of the elements in the stack.
*required
hstack
hstack
Flex layout element to render an horizontal stack of elements. Use spacer
, divider
, and box
to complete the layout.
children
*
Array<Block>
Content to display in the stack.
align
'start' | 'center' | 'end'
Vertical alignment of the elements in the stack.
*required
divider
divider
A visual delimiter between 2 elements of a containing stack layout.
style
"default" | "line"
Visual style for the divider.
size
"medium" | "small" | "large"
Spacing of the divider (default to medium
).
Display
box
box
children
*
Array<Block> | Array<Inline>
Content to display in the block.
style
'card' | 'secondary' | 'default'
Visual style for the box.
grow
number
Specifies how much of the remaining space in the container should be assigned to the element.
*required
card
card
children
Array<Block> | Array<Inline>
Content to display in the block.
title
string
Title for the card.
hint
string
Hint for the card.
icon
Icon or Image displayed with the card.
buttons
Array<Button>
Button(s) displayed in the top right corner of the card.
*required
text
text
The text element is used for rendering blocks of text with formatting.
children
*
Array<string | Text>
Content of the text element.
style
*
"bold" | "italic" | "strikethrough" | "code"
Style to format the text with.
*required
image
image
The image component allows you to use images in your integration.
source
*
object
Content to load in the image.
source.url
*
string
URL of the image to load
aspectRatio
*
number
Aspect ratio to use for the image.
*required
markdown
markdown
Rich-text formatting of Markdown content.
content
*
string
Markdown text content to render
*required
Interactive
modal
modal
Overlay modal
children
*
Array<Block> | Array<Inline>
Block items to display inside the modal.
title
string
Title of the modal
subtitle
string
Subtitle of the modal
size
'medium'
| 'xlarge'
| 'fullscreen'
Size of the modal
returnValue
object
Data passed back to the parent view when the modal is closed. These data are accessible in the @ui.modal.close action
submit
Button
Button instance that triggers an action.
*required
button
button
Interactive pressable button, triggering a component action when clicked.
label
*
string
Text displayed in the button
style
'primary' | 'secondary' | 'danger'
Visual style for the button
tooltip
string
Text displayed in an hovering tooltip
icon
Visual icon to display on the start of the button
confirm
object
Modal object to display to ask the user to confirm the action before execution
confirm.title
*
string
Title for the confirmation modal
confirm.text
*
string
Content of the confirmation modal
confirm.confirm
*
string
Label for the confirmation button
confirm.style
*
'primary' | 'danger'
Style of the confirmation button
*required
textinput
textinput
An input component is used to capture text input from the end user. When an action is being dispatched to the integration, the value of the input is stored in the state value referenced by id
.
state
*
string
State binding. The value of the input will be stored as a property in the state named after this ID.
initialValue
string
Initial value of the input.
label
string
Label to display next to the input.
placeholder
string
Text that appears in the form control when it has no value set
*required
codeblock
codeblock
Multi-lines code blocks with syntax highlighting.
content
*
string
Text content for the codeblock
syntax
string
Syntax to use for highlighting
lineNumbers
boolean | number
Control the display of the line numbers
buttons
Array<Button>
Buttons to render as an overlay in top-right corner
state
string
Editable state binding. The value of the input will be stored as a property in the state named after this ID. Passing this property automatically makes the code-block editable.
onContentChange
Action
Action dispatched when the user has edited the content of this code block. It only applies if a state
is passed. Usually the action is dispatched when the user is no longer focusing the code-block.
See Actions for more information.
*required
webframe
webframe
Element to render an external URL. The frame can receive update when states are updated by defining dependencies with data
(see interactivity for more details).
source
*
object
Content to load in the frame
source.url
*
string
URL of the content to load
aspectRatio
*
number
Aspect-ratio (width / height) for the block
buttons
Array<Button>
Buttons to render as an overlay in top-right corner
data
Record<string, string | DynamicBinding>
States this webframe is depend on. Each state update will cause the webframe to receive a message.
*required
select
select
Select item
state
*
string
State binding. The value of the input will be stored as a property in the state named after this ID.
initialValue
string
| string[]
The initial value for the select component
placeholder
string
Placeholder value for the select component
multiple
boolean
Should the select accept the selection of multiple options. If true, the state will be an array.
options
Array<object>
Options for the select component
options.id
string
Unique ID for the option
options.label
string
Label for the option
options.url
string
URL for the option if using an external link
*required
switch
switch
A switch component to toggle between on and off.
state
*
string
State binding. The value of the input will be stored as a property in the state named after this ID.
initialValue
boolean
Value to initialize the switch with.
confirm
object
Modal object to display to ask the user to confirm the action before execution
confirm.title
*
string
Title for the confirmation button
confirm.text
*
string
Content for the confirmation button
confirm.confirm
*
string
Label for the confirmation button
confirm.style
*
'primary' | 'danger'
Style for the confirmation button
*required
checkbox
checkbox
A checkbox component to toggle between checked and unchecked.
state
*
string
State binding. The value of the input will be stored as a property in the state named after this ID.
value
string | number
Value to store in a state array when the checkbox is selected.
confirm
object
Modal object to display to ask the user to confirm the action before execution
confirm.title
*
string
Title for the confirmation button
confirm.text
*
string
Content for the confirmation button
confirm.confirm
*
string
Label for the confirmation button
confirm.style
*
'primary' | 'danger'
Style for the confirmation button
*required
radio
radio
A radio component.
state
*
string
State binding. The value of the input will be stored as a property in the state named after this ID.
value
string | number
Value to store in a state array when the checkbox is selected.
confirm
object
Modal object to display to ask the user to confirm the action before execution
confirm.title
*
string
Title for the confirmation button
confirm.text
*
string
Content for the confirmation button
confirm.confirm
*
string
Label for the confirmation button
confirm.style
*
'primary' | 'danger'
Style for the confirmation button
*required
Last updated