useState, useEffect, …) come from react.
Hooks and components marked 2.1 were added in SDK 2.1.0. Using them requires
"sdkVersion": "^2.1.0".Hooks
useProjectState
count.
useGlobalState
Both are for small, JSON-serialisable values. They share their store with
sdk.storage: useGlobalState reads storage.*, and useProjectState reads storage.project(id).*, on mount. For project data, write to the project with sdk.project.useProject
useNavigate
route opens a page registered with sdk.routes.register.
useWindowTitle
useSetting
2.1sdk.settings.set.
useItem
2.1setField goes through the editor’s history, presence and autosave, exactly like a built-in edit.
useT
2.1sdk.i18n.strings. Re-renders when the user changes language.
useTheme
2.1theme is the selected theme id, mode is 'dark' or 'light', and cssVar(name) reads a CSS variable’s current value. Live.
More hooks
2.1Components
Components take the props the app uses for them;onChange on inputs receives the value, not the event.
Buttons and inputs
Layout and containers
Feedback and display
ContextMenu items are { key, label, icon, shortcut, danger, disabled, hidden, onClick }, or { type: 'separator' }.
Items, textures and models
Icons
CodeEditor, VanillaItemPicker, ItemPreview, ItemPicker, DataTable, TexturePreview, PixelEditor and RichTextInput load on first render, so they may take a moment the first time.
The kit has no sound or effect picker. Build one with Select and sdk.minecraft.sounds() or effects():
Styling
Import a CSS file and it is scoped to your expansion, so plain element selectors are safe:sdk.theme.