UI Special Types
Special entitiy types for the UI, including dropdowns and input boxes.
Dropdown
import { UiEntity, Label, Dropdown, ReactEcs } from '@dcl/sdk/react-ecs'
import { Color4 } from '@dcl/sdk/math'
import { Color4Type } from '@dcl/sdk/ecs'
function selectOption(index: number) {
switch (index) {
case 0:
textColor = Color4.Red()
break
case 1:
textColor = Color4.Blue()
break
case 2:
textColor = Color4.Green()
break
}
}
let textColor: Color4Type = Color4.Red()
export const uiMenu = () => (
<UiEntity
uiTransform={{
width: '200px',
height: '100px',
alignContent: 'auto',
flexDirection: 'column',
alignSelf: 'center',
}}
>
<Label
value="Select a color"
fontSize={18}
color={textColor}
uiTransform={{
width: '140px',
height: '40px',
}}
/>
<Dropdown
options={[`Red`, `Blue`, `Green`]}
onChange={selectOption}
uiTransform={{
width: '100px',
height: '40px',
}}
/>
</UiEntity>
)Input text
Last updated