@bedrock-core/ore-styled
v0.9.2
Published
Ore-UI styled compound components for @bedrock-core/ui
Downloads
1,173
Maintainers
Readme
@bedrock-core/ore-styled
Optional prebuilt Ore-UI styled compound components for @bedrock-core/ui.
Drop-in styled components that match Minecraft's modern Ore-UI look. Skip the styling boilerplate when you want consistent buttons, toggles, tabs, and cards in your addon UI.
Install
yarn add @bedrock-core/ore-styled
# or
npm install @bedrock-core/ore-styledComponents
Button— styled press button with variantsCard— content container with Ore-UI framingCheckbox— boolean input with on/off texturesInput— text field; pressing it opens the native modal text fieldDropdown— selector field with a chevron; pressing it opens the native modal dropdownSlider— field drawn as a track + thumb (positioned by value); pressing it opens the native modal sliderRadioGroup/Radio— single-select groupTabs/TabList/Tab/TabPanel— tabbed navigationToggle— switch-style boolean inputToggleButtonGroup/ToggleButtonItem— multi-button selectorForm— native modal form with styled fields (see below)Divider— horizontal/vertical separatorItemSlot— single inventory slot rendering anItemStackwith optional overlay textureItemContainer— grid ofItemSlotcomponents covering aContainer's slotsEquipmentSlots— vertical column of equipment slots (helmet → boots + offhand) from anEntityEquippableComponenttheme— design tokens for ad-hoc styling
Usage
import { Card, Toggle, Checkbox } from '@bedrock-core/ore-styled';
import { Text, useState } from '@bedrock-core/ui';
export const Settings = () => {
const [enabled, setEnabled] = useState(false);
const [accepted, setAccepted] = useState(false);
return (
<Card>
<Text>{'Settings'}</Text>
<Toggle on={enabled} onChange={setEnabled} />
<Checkbox checked={accepted} onChange={setAccepted} label={'I agree'} />
</Card>
);
};Forms
Form is a native ModalFormData-backed modal with an atomic, single-submit lifecycle: every field's value arrives once, in onSubmit, keyed by its name. Field members mirror the runtime's Form namespace but come pre-styled, and each takes a label (composed here — the runtime primitives are label-free):
Form.Toggle— settings-row switchForm.Checkbox— boolean with on/off texturesForm.Radio— single-select group fromoptionsForm.ToggleButton— multi-button selector fromoptionsForm.Slider— track + thumb, label aboveForm.Dropdown— native modal dropdown, label aboveForm.Input— text field, label aboveForm.Button— submit / exit action button (variant defaults toprimaryfor submit,secondaryfor exit)
A form must declare exactly one Form.Button type="submit" (and at most one type="exit"), placed anywhere in the flow.
import { Form } from '@bedrock-core/ore-styled';
import { Text } from '@bedrock-core/ui';
export const Settings = () => (
<Form onSubmit={(v) => { v.sound; v.volume; v.mode; }}>
<Text>{'§lSettings'}</Text>
<Form.Toggle name={'sound'} label={'Sound'} defaultValue={true} />
<Form.Slider name={'volume'} label={'Volume'} min={0} max={10} />
<Form.Dropdown name={'mode'} label={'Mode'} options={['Easy', 'Hard']} />
<Form.Input name={'nick'} label={'Nickname'} />
<Form.Button type={'submit'} label={'Save'} />
</Form>
);Mix a modal <Form> and an ActionForm-style screen across separate render() calls (e.g. via navigation) — never nested.
Resource pack
These components render through the companion @bedrock-core/ui resource pack — make sure the latest .mcpack from the releases page is installed alongside your addon.
License
MIT — see the root repository.
