dioxus/examples
2022-11-15 16:37:23 -08:00
..
assets feat: default asset server 2022-01-27 16:36:17 -05:00
all_css.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
all_events.rs wip: pass more events 2022-11-15 16:37:23 -08:00
borrowed.rs Remove argument from use_hook closure (#496) 2022-07-11 15:50:56 -04:00
calculator.rs Less clumsy configuration for desktop and mobile (#553) 2022-09-13 16:22:27 -07:00
crm.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
custom_assets.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
custom_element.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
custom_html.rs Less clumsy configuration for desktop and mobile (#553) 2022-09-13 16:22:27 -07:00
disabled.rs chore: remove unnecessary brackets from examples (#552) 2022-09-13 14:57:23 -07:00
dog_app.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
error_handle.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
eval.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
fermi.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
file_explorer.rs feat: add an unhygenic render macro (#556) 2022-09-25 01:05:16 -07:00
filedragdrop.rs Less clumsy configuration for desktop and mobile (#553) 2022-09-13 16:22:27 -07:00
flat_router.rs Less clumsy configuration for desktop and mobile (#553) 2022-09-13 16:22:27 -07:00
form.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
framework_benchmark.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
heavy_compute.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
hello_world.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
hydration.rs wip: pass more events 2022-11-15 16:37:23 -08:00
inlineprops.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
inputs.rs wip: pass more events 2022-11-15 16:37:23 -08:00
link.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
login_form.rs wip: pass more events 2022-11-15 16:37:23 -08:00
nested_listeners.rs chore: remove unnecessary brackets from examples (#552) 2022-09-13 14:57:23 -07:00
optional_props.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
pattern_model.rs wip: pass more events 2022-11-15 16:37:23 -08:00
pattern_reducer.rs chore: remove unnecessary brackets from examples (#552) 2022-09-13 14:57:23 -07:00
README.md Remove outdated example; Add note on performance benchmark 2022-06-30 22:58:34 +03:00
readme.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
router.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
rsx_compile_fail.rs chore: remove unnecessary brackets from examples (#552) 2022-09-13 14:57:23 -07:00
rsx_usage.rs chore: remove unnecessary brackets from examples (#552) 2022-09-13 14:57:23 -07:00
simple_list.rs feat: implement type magic to allow strings, format args, and other types directly in rsx (#550) 2022-09-12 22:49:04 -07:00
ssr.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
suspense.rs Less clumsy configuration for desktop and mobile (#553) 2022-09-13 16:22:27 -07:00
svg.rs wip: pass more events 2022-11-15 16:37:23 -08:00
svg_basic.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
tailwind.rs Less clumsy configuration for desktop and mobile (#553) 2022-09-13 16:22:27 -07:00
tasks.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
textarea.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
todomvc.rs Less clumsy configuration for desktop and mobile (#553) 2022-09-13 16:22:27 -07:00
window_event.rs Less clumsy configuration for desktop and mobile (#553) 2022-09-13 16:22:27 -07:00
window_zoom.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
xss_safety.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00

Examples

These examples are fully-fledged mini Dioxus apps.

You can run them with cargo run --example EXAMPLE_NAME. Example:

cargo run --example hello_world

(Most of these examples are run through webview, so you don't need the Dioxus CLI installed)

Basic Features

hello_world - Most basic example

readme - Counter example from the Readme

custom_assets - Include images

custom_element - Render webcomponents

custom_html - Customize wrapper HTML

eval - Evaluate JS expressions

RSX

rsx_usage - Demo of all RSX features

xss_safety - You can include text without worrying about injections by default

Props

borrowed - Borrowed props

inlineprops - Demo of inline_props macro

optional_props - Optional props

CSS

all_css - You can specify any CSS attribute

tailwind - You can use a library for styling

Input Handling

all_events - Basic event handling demo

filedragdrop - Handle dropped files

form - Handle form submission

inputs - Input values

nested_listeners - Nested handlers and bubbling

textarea - Text area input

State Management

fermi - Fermi library for state management

pattern_reducer - The reducer pattern with use_state

rsx_compile_fail

Async

login_form - Login endpoint example

suspense - Render placeholders while data is loading

tasks - Continuously run future

SVG

svg_basic

svg

Performance

framework_benchmark - Renders a huge list

Note: The benchmark should be run in release mode:

cargo run --example framework_benchmark --release

heavy_compute - How to deal with expensive operations

Server-side rendering

ssr - Rendering RSX server-side

hydration - Pre-rendering with hydration

Common Patterns

disabled - Disable buttons conditionally

error_handle - Handle errors with early return

Routing

flat_router - Basic, flat route example

router - Router example

link - Internal, external and custom links

Platform Features

window_event - Window decorations, fullscreen, minimization, etc.

window_zoom Zoom in or out

Example Apps

calculator - Simple calculator

pattern_model - Simple calculator, but using a custom struct as the model

crm - Toy multi-page customer management app

dog_app - Accesses dog API

file_explorer - File browser that uses use_ref to interact with the model

todomvc - Todo task list example

Terminal UI

tui_border

tui_buttons

tui_color_test

tui_components

tui_frame

tui_hover

tui_keys

tui_list

tui_margin

tui_quadrants

tui_readme

tui_task

tui_text

TODO

Missing Features

  • Fine-grained reactivity
  • Refs - imperative handles to elements
  • Function-driven children: Pass functions to make VNodes

Missing examples

  • Shared state
  • Root-less element groups
  • Spread props
  • Custom elements
  • Component Children: Pass children into child components
  • Render To string: Render a mounted virtualdom to a string
  • Testing and Debugging