Skip to main content

Core Components and Native Components

Hosanna components are BaseView subclasses with generated state and factory contracts. A component can be a primitive, a control, a layout group, or an application-defined composition of other views.

Shared Building Blocks​

AreaCurrent examplesUse
PrimitivesLabel, Image, Rectangle, Shape, VideoPlayerDisplay content through Roku SceneGraph and its simulator
GroupsGroup, HGroup, VGroup, GridGroup, Spacer, MaskCompose and lay out child structs
ControlsButton, CheckBox, ComboBox, TextInput, ScrollView, ScrollContainer, TabSelectorFocusable and interactive behavior
App componentsGenerated factories such as LoadingSpinner(...)Reusable product-specific state and presentation

Renderers and Native Boundaries​

  • Roku uses SceneGraph-compatible nodes and generated BrightScript.

The shared view contract keeps state, layout, and events consistent, but it does not imply that every control maps to one specific host widget. Do not use an assumed platform analogue as API documentation.

Use typed SceneGraph interfaces and Roku component nodes for native integrations. Keep browser simulation of those integrations behind the same contract. Narrow hs_native_roku snippets are available for BrightScript interop that the typed bridge cannot express. See Roku native development and Using Native Libraries.

Example​

@view('SimpleLayout')
export class SimpleLayoutView extends BaseView<SimpleLayoutState> {
protected getViews(): ViewStruct<ViewState>[] {
return [
VGroup([
Label({ text: 'Welcome to Hosanna UI!' }),
HGroup([
Button({ text: 'OK' }).isInitialFocus(),
Button({ text: 'Cancel' }),
]).itemSpacing(20),
Image({
imageUri: 'pkg:/assets/images/logo.png',
width: 200,
height: 100,
}),
Rectangle({ width: 400, height: 2, color: '#cccccc' }),
]).itemSpacing(30)
];
}
}

The example omits imports and the generated-file preamble for brevity. A real view must export its generated factory/struct and use the generated state type, as shown in Hosanna Fundamentals.

For a data-driven catalog, use the collection surfaces documented in the Collections section rather than building an unbounded tree with groups or a ScrollView.

Talk to us