dioxus/examples
2022-12-30 02:41:09 -05:00
..
assets feat: default asset server 2022-01-27 16:36:17 -05:00
all_css.rs chore: clean up interpreter and bindings 2022-12-05 16:47:04 -08:00
all_events.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
borrowed.rs chore: clean up interpreter and bindings 2022-12-05 16:47:04 -08:00
button.rs chore: swap over router none 2022-12-22 14:45:48 -05:00
calculator.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
callback.rs chore: clean up desktop 2022-12-06 16:37:28 -08:00
clock.rs chore: clean up clock 2022-12-30 02:41:09 -05:00
crm.rs fix: save listeners, borrowed props, and pull back props 2022-12-16 19:54:33 -08:00
custom_assets.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
custom_element.rs feat: fix the scope rollover bug 2022-12-12 18:31:30 -08:00
custom_html.rs Less clumsy configuration for desktop and mobile (#553) 2022-09-13 16:22:27 -07:00
disabled.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
dog_app.rs wip: continue to tweak suspense 2022-11-22 10:05:13 -08:00
error_handle.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
eval.rs fix eval example 2022-12-30 02:06:33 -05:00
fermi.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
file_explorer.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
filedragdrop.rs Less clumsy configuration for desktop and mobile (#553) 2022-09-13 16:22:27 -07:00
flat_router.rs fix: advance dynamic root 2022-12-16 22:39:27 -08:00
form.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
framework_benchmark.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
generic_component.rs feat: event handling on desktop 2022-11-17 20:00:39 -08: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 chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
inlineprops.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
inputs.rs feat: event handling on desktop 2022-11-17 20:00:39 -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: clean up desktop 2022-12-06 16:37:28 -08:00
optional_props.rs Renderers are now packages, not features. (#387) 2022-07-09 15:15:20 -04:00
pattern_model.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
pattern_reducer.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
README.md fix tui example links (#607) 2022-10-28 18:06:39 -07:00
readme.rs fix: window zoom 2022-12-30 02:09:02 -05:00
router.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
rsx_compile_fail.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
rsx_usage.rs chore: remove cross-crate doc comments 2022-12-09 15:03:56 -08:00
simple_desktop.rs cargo fmt 2022-12-13 15:19:52 -08:00
simple_list.rs chore: make for loops not the same 2022-11-17 22:55:46 -08:00
ssr.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
suspense.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
svg.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
svg_basic.rs fix: parsing of attributes without trailing commas 2022-12-12 11:18:36 -08:00
tailwind.rs Less clumsy configuration for desktop and mobile (#553) 2022-09-13 16:22:27 -07:00
tasks.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
textarea.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
todomvc.rs fix desktop to poll without budget 2022-12-29 20:39:22 -05:00
window_event.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08:00
window_zoom.rs chore: clean up zoom example 2022-12-30 02:32:53 -05:00
xss_safety.rs chore: rename all &cx to cx, make clipppy happy 2022-12-07 13:11:40 -08: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_all_events - All of the terminal events

tui_border - Different styles of borders and corners

tui_buttons - A grid of buttons that work demonstrate the focus system

tui_color_test - Grid of colors to demonstrate compatablility with different terminal color rendering modes

tui_colorpicker - A colorpicker

tui_components - Simple component example

tui_flex - Flexbox support

tui_hover - Detect hover and mouse events

tui_list - Renders a list of items

tui_margin - Margins around flexboxes

tui_quadrants - Four quadrants

tui_readme - The readme example

tui_task - Background tasks

tui_text - Simple text example

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