Skip to content

Instantly share code, notes, and snippets.

@mattmazzola
Last active September 1, 2024 19:41
Show Gist options
  • Save mattmazzola/556841456ff735cb05bc12d27744c960 to your computer and use it in GitHub Desktop.
Save mattmazzola/556841456ff735cb05bc12d27744c960 to your computer and use it in GitHub Desktop.
Markdown test
React Omniverse
Styling
class="my_class" name="my_class"
.my_class { ... } Element.my_class { ... }
id="my_id" style_type_name_override="my_id"
my_id { ... } MyId { ... }
Layout
flexbox, flex-direction: row, gap: gap ui.VStack(spacing=gap)
flexbox, flex-direction: column, gap: gap ui.HStack(spacing=gap)
position: absolute or z-index ui.ZStack (implicit based on order)
Elements
<button></button> ui.Button(...)
<textarea></textarea> ui.TextBlock(...)
... ...
State
- numbers
const [value, setValue] = React.useState(initial_value)
useEffect(onChanged, [value])
model = ui.SimpleIntModel(initial_value)
model.add_value_changed_fn(on_changed)
- text
[same of above] ui.SimpleStringModel(initial_value)
...
Modals
<dialog> <React.portal> ui.Window
Components
<MyCounter onValueChanged={onCounterChanged} /> my_counter = create_counter()
my_counter.int_model.add_value_changed_fn(on_counter_changed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment