Files
dioxus/examples
Reinis Mazeiks 6c323e9fc5 Rework Guide (#486)
* Move getting started to Guide

* Clean up summary and getting started

* Shorten intro by moving stuff to individual platform docs

* Make intro even shorter, summarize features

* Further cleanup; move development-related docs to separate section

* Make `guide` a crate. Turn code samples into examples so that we can check if they compile

* Rewrite "Describing the UI":

* Focus on RSX syntax (interactivity covered in later chapters); make sure samples are tested; concise language

* Move some "special attribute" samples to the `examples` directory

* Simplify introduction to components

* Simplify introduction to component props

* Document Prop features; add code samples

* Simplify component children docs

* Interactivity: better introduction to events

* Hooks: better introduction

* Remove outdated doc

* Introducs use_ref

* Simplify User Input chapter

* Document event handler props

* Meme editor example

* Meme editor walkthrough

* Add dark mode example

* Guide for context; dark mode example

* Guide: custom hooks

* Guide: conditional rendering

* Guide: rendering lists

* Guide: rendering lists + keys

* Move remaining infor from Reference to guide

* Delete reference book
2022-07-07 08:50:36 +00:00
..
2022-01-27 16:36:17 -05:00
2022-07-07 08:50:36 +00:00
2022-02-11 15:50:07 -05:00
2022-02-28 02:38:17 -05:00
2022-05-12 14:36:52 +03:00
2022-03-06 20:37:57 -05:00
2022-01-27 16:37:09 -05:00
2022-04-24 19:44:20 -04:00
2022-03-04 14:29:45 -05:00
2022-03-09 18:11:40 -05:00
2022-03-19 03:11:30 +01:00
2022-02-28 02:38:17 -05:00
2022-03-05 15:25:09 -05:00
2022-03-05 16:10:17 -05:00
2022-03-04 14:29:45 -05:00
2022-03-05 15:25:09 -05:00
2022-03-05 15:25:09 -05:00
2022-02-23 08:44:16 -05:00
2022-03-05 15:25:09 -05:00
2022-03-04 14:29:45 -05:00
2022-03-05 17:07:34 -05:00
2022-03-05 15:25:09 -05:00
2022-03-04 14:29:45 -05:00
2022-02-21 15:39:47 -05:00
2022-03-04 14:29:45 -05:00
2022-04-16 16:59:41 -04:00
2022-03-06 20:37:57 -05:00
2022-03-04 14:29:45 -05:00
2022-07-02 23:45:32 -04:00
2022-07-05 19:44:54 -05:00
2022-03-09 13:36:30 -05:00
2022-03-09 13:36:30 -05:00
2022-03-09 13:36:30 -05:00
2022-03-09 13:36:30 -05:00
2022-03-09 13:36:30 -05:00
2022-03-09 13:36:30 -05:00
2022-03-04 14:29:45 -05:00
2022-05-12 08:41:30 +08:00
2022-03-04 14:29:45 -05: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