Create A Widget
Start from a small view tree, then add data, panels, timelines, and intents only when needed.
Steps
- Create or open an Await widget project.
- Ensure
package.jsonincludes@await-widget/runtimeandtypescript. - Ensure
tsconfig.jsonuses:
json
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "await",
"types": ["@await-widget/runtime"]
}
}- Import components from
await. - Implement
widget. - Register it with
Await.define. - Run
npm test.
Starter Template
tsx
import {Text, VStack} from 'await';
// @panel {type:'color'}
const accent = 'blue';
function widget() {
return (
<VStack spacing={8} maxSides padding={16} background='background'>
<Text value='Await' fontSize={18} fontWeight='semibold'/>
<Text value='Small things, close at hand' foreground={accent} minimumScaleFactor={0.7}/>
</VStack>
);
}
Await.define({
widget,
});AI Checklist
- Use only components listed in Components.
- Use only props and modifiers listed in Props And Modifiers.
- Put
paddingbeforebackgroundwhen the background should include the padded area. - Use
maxSideson the root when the widget should fill the available size. - Add stable
idvalues for animated or changing visual entities.