Inputs & outputs (Alpha)
Inputs
Examples and code snippets

# components/media-types.jigx
type: component.default
# Inputs determine the name, alignment, indicator and value of the tabs
inputs:
# inputs for indicators
tabIndicator1:
required: false
type: boolean
tabIndicator2:
required: false
type: boolean
tabIndicator3:
required: false
type: boolean
tabIndicator4:
required: false
type: boolean
# inputs for tab names
tabName1:
required: true
type: string
tabName2:
required: true
type: string
tabName3:
required: false
type: string
tabName4:
required: false
type: string
# inputs for tab values
tabValue1:
required: true
type: string
tabValue2:
required: true
type: string
tabValue3:
required: false
type: string
tabValue4:
required: false
type: string
# input to determine alignment of the tab, e.g. center, left, right.
tabsAlignment:
required: false
type: string
children:
# There are 4 tabs configured in this custom component.
# Using the view component creates the layout for the tabs
# Tab 1
- type: component.view
options:
style:
border:
bottom:
style: solid
flex:
direction: row
grow: 1
justifyContent: center
margin:
vertical: medium
children:
- type: component.view
when: =@ctx.inputs.tabValue1 != null
options:
style:
flex:
direction: row
grow: =@ctx.inputs.stretchTabs = true ? 1:0
gap: minimal
padding:
left: =@ctx.inputs.tabsAlignment = "center" ? "medium":"none"
right: =@ctx.inputs.tabsAlignment = "center" ? "medium":"large"
children:
- type: component.view
options:
style:
gap: medium
children:
- type: component.view
options:
style:
alignItems: center
flex:
direction: row
gap: minimal
justifyContent: center
# Using the text component to configure the tab text
children:
- type: component.text
options:
emphasis: =@ctx.solution.state.tab = @ctx.inputs.tabValue1 ? "":"medium"
value: =@ctx.inputs.tabName1
weight: bold
- type: component.view
options:
children: []
style:
background:
color:
=@ctx.solution.state.tab = @ctx.inputs.tabValue1 ?
"element":"transparent"
flex:
grow: 1
height: 2
- type: component.view
when: =@ctx.inputs.tabIndicator1 = true
options:
style:
flex:
grow: 1
children:
- type: component.view
options:
children: []
style:
background:
color: negative
height: 6
radius: large
width: 6
# Configure the onPress event to show the content in tab 1 when it is pressed.
onPress:
type: action.set-state
options:
state: =@ctx.solution.state.tab
value: =@ctx.inputs.tabValue1
# Tab 2
# Using the view component creates the layout for the tabs
- type: component.view
when: =@ctx.inputs.tabValue2 != null
options:
style:
flex:
direction: row
gap: minimal
padding:
left: =@ctx.inputs.tabsAlignment = "center" ? "medium":"none"
right: =@ctx.inputs.tabsAlignment = "center" ? "medium":"large"
children:
- type: component.view
options:
style:
gap: medium
children:
- type: component.view
options:
style:
alignItems: center
flex:
direction: row
gap: minimal
justifyContent: center
children:
- type: component.text
options:
emphasis: =@ctx.solution.state.tab = @ctx.inputs.tabValue2 ? "":"medium"
value: =@ctx.inputs.tabName2
weight: bold
- type: component.view
options:
children: []
style:
background:
color:
=@ctx.solution.state.tab = @ctx.inputs.tabValue2 ?
"element":"transparent"
flex:
grow: 1
height: 2
- type: component.view
when: =@ctx.inputs.tabIndicator2 = true
options:
style:
flex:
grow: 1
children:
- type: component.view
options:
children: []
style:
background:
color: negative
height: 6
radius: large
width: 6
# Configure the onPress event to show the content in tab 2 when it
# is pressed.
onPress:
type: action.set-state
options:
state: =@ctx.solution.state.tab
value: =@ctx.inputs.tabValue2
# Tab 3
# Using the view component creates the layout for the tabs
- type: component.view
when: =@ctx.inputs.tabValue3 != null
options:
style:
flex:
direction: row
gap: minimal
padding:
left: =@ctx.inputs.tabsAlignment = "center" ? "medium":"none"
right: =@ctx.inputs.tabsAlignment = "center" ? "medium":"large"
children:
- type: component.view
options:
style:
gap: medium
children:
- type: component.view
options:
style:
alignItems: center
flex:
direction: row
gap: minimal
justifyContent: center
children:
- type: component.text
options:
emphasis: =@ctx.solution.state.tab = @ctx.inputs.tabValue3 ? "":"medium"
value: =@ctx.inputs.tabName3
weight: bold
- type: component.view
options:
children: []
style:
background:
color:
=@ctx.solution.state.tab = @ctx.inputs.tabValue3 ?
"element":"transparent"
flex:
grow: 1
height: 2
- type: component.view
when: =@ctx.inputs.tabIndicator3 = true
options:
style:
flex:
grow: 1
children:
- type: component.view
options:
children: []
style:
background:
color: negative
height: 6
radius: large
width: 6
# Configure the onPress event to show the content in tab 3 when
# it is pressed.
onPress:
options:
state: =@ctx.solution.state.tab
value: =@ctx.inputs.tabValue3
type: action.set-state
# Tab 4
# Using the view component creates the layout for the tabs
- type: component.view
when: =@ctx.inputs.tabValue4 != null
options:
style:
flex:
direction: row
gap: minimal
padding:
left: =@ctx.inputs.tabsAlignment = "center" ? "medium":"none"
right: =@ctx.inputs.tabsAlignment = "center" ? "medium":"large"
children:
- type: component.view
options:
style:
gap: medium
children:
- type: component.view
options:
style:
alignItems: center
flex:
direction: row
gap: minimal
justifyContent: center
children:
- type: component.text
options:
emphasis: =@ctx.solution.state.tab = @ctx.inputs.tabValue4 ? "":"medium"
value: =@ctx.inputs.tabName4
weight: bold
- type: component.view
options:
children: []
style:
background:
color:
=@ctx.solution.state.tab = @ctx.inputs.tabValue4 ?
"element":"transparent"
flex:
grow: 1
height: 2
- type: component.view
when: =@ctx.inputs.tabIndicator4 = true
options:
style:
flex:
grow: 1
children:
- type: component.view
options:
children: []
style:
background:
color: negative
height: 6
radius: large
width: 6
# Configure the onPress event to show the content in tab 4 when
# it is pressed.
onPress:
type: action.set-state
options:
state: =@ctx.solution.state.tab
value: =@ctx.inputs.tabValue4Outputs
Examples and code snippets

See also
Last updated
Was this helpful?