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
..
assets feat: default asset server 2022-01-27 16:36:17 -05:00
core_reference Rework Guide (#486) 2022-07-07 08:50:36 +00:00
all_css.rs feat: add all the css 2022-02-11 15:50:07 -05:00
all_events.rs chore: clean up example a bit more 2022-07-02 23:17:48 -04:00
borrowed.rs examples: clippy 2022-02-28 02:38:17 -05:00
calculator.rs Update interpreter and example 2022-05-12 14:36:52 +03:00
crm.rs docs: even more docs 2022-03-06 20:37:57 -05:00
custom_assets.rs examples: fixup asset example 2022-01-27 16:37:09 -05:00
custom_element.rs feat: custom element example 2022-04-24 19:44:20 -04:00
custom_html.rs feat: allow customizing the index and head 2022-04-16 16:53:47 -04:00
disabled.rs feat: re-unify set_state 2022-03-04 14:29:45 -05:00
dog_app.rs feat: update release posts 2022-03-09 18:11:40 -05:00
error_handle.rs docs: more docs and an errorhandling example 2022-03-08 14:15:18 -05:00
eval.rs add a desktop eval example 2022-03-19 03:11:30 +01:00
fermi.rs fix: subscription should apply internally to hook 2022-04-24 20:51:52 -04:00
file_explorer.rs examples: clippy 2022-02-28 02:38:17 -05:00
filedragdrop.rs fix: some examples 2022-03-05 15:25:09 -05:00
flat_router.rs fix: format examples 2022-03-05 16:10:17 -05:00
form.rs Add some radio buttons to the form example 2022-03-19 17:05:48 -06:00
framework_benchmark.rs feat: re-unify set_state 2022-03-04 14:29:45 -05:00
heavy_compute.rs fix: ping window after virtualdom is ready 2022-02-19 17:34:44 -05:00
hello_world.rs chore: remove unused import in example 2022-01-07 22:13:05 -05:00
hydration.rs feat: re-unify set_state 2022-03-04 14:29:45 -05:00
inlineprops.rs docs: an example for inlineprops 2022-03-20 20:59:50 +01:00
inputs.rs fix: some examples 2022-03-05 15:25:09 -05:00
link.rs fix: some examples 2022-03-05 15:25:09 -05:00
login_form.rs fix: login example 2022-02-23 08:44:16 -05:00
nested_listeners.rs fix: some examples 2022-03-05 15:25:09 -05:00
optional_props.rs updated examples with the new optional props 2022-03-16 06:36:39 +00:00
pattern_model.rs Update examples to avoid deprecated API 2022-05-12 15:00:43 +03:00
pattern_reducer.rs feat: re-unify set_state 2022-03-04 14:29:45 -05:00
README.md Remove outdated example; Add note on performance benchmark 2022-06-30 22:58:34 +03:00
readme.rs feat: enable addassign for usestate 2022-03-05 17:07:34 -05:00
router.rs fix: some examples 2022-03-05 15:25:09 -05:00
rsx_compile_fail.rs feat: re-unify set_state 2022-03-04 14:29:45 -05:00
rsx_usage.rs test: Add test for generic components 2022-06-04 13:40:50 +03:00
ssr.rs feat: overhaul examples and clean things up 2022-01-03 00:42:17 -05:00
suspense.rs feat: use future fully figured out 2022-02-21 15:39:47 -05:00
svg.rs feat: re-unify set_state 2022-03-04 14:29:45 -05:00
svg_basic.rs Example: SVG Basic shapes from https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Basic_Shapes 2022-05-21 00:13:48 +08:00
tailwind.rs docs: use tailwindv3 in examples 2022-04-16 16:59:41 -04:00
tasks.rs docs: even more docs 2022-03-06 20:37:57 -05:00
textarea.rs feat: re-unify set_state 2022-03-04 14:29:45 -05:00
todomvc.rs Update examples to avoid deprecated API 2022-05-12 15:00:43 +03:00
tui_all_events.rs chore: make clippy happy 2022-07-02 23:45:32 -04:00
tui_border.rs Update examples to avoid deprecated fields 2022-05-12 11:03:51 +03:00
tui_buttons.rs Fix some warnings: avoid deprecated fields 2022-06-29 02:13:01 +03:00
tui_color_test.rs add builder pattern and update examples 2022-04-21 06:29:22 -05:00
tui_colorpicker.rs add query context (#400) 2022-07-05 19:44:54 -05:00
tui_components.rs feat: update examples for tui 2022-03-09 13:36:30 -05:00
tui_frame.rs feat: update examples for tui 2022-03-09 13:36:30 -05:00
tui_hover.rs Update examples to avoid deprecated fields 2022-05-12 11:03:51 +03:00
tui_keys.rs Merge branch 'master' of https://github.com/DioxusLabs/dioxus into rusty-events 2022-06-28 21:09:20 +03:00
tui_list.rs feat: update examples for tui 2022-03-09 13:36:30 -05:00
tui_margin.rs feat: update examples for tui 2022-03-09 13:36:30 -05:00
tui_quadrants.rs feat: update examples for tui 2022-03-09 13:36:30 -05:00
tui_readme.rs feat: update examples for tui 2022-03-09 13:36:30 -05:00
tui_task.rs feat: update examples for tui 2022-03-09 13:36:30 -05:00
tui_text.rs Update examples to avoid deprecated fields 2022-05-12 11:03:51 +03:00
window_event.rs feat: re-unify set_state 2022-03-04 14:29:45 -05:00
window_zoom.rs example: update example 2022-05-12 08:41:30 +08:00
xss_safety.rs feat: re-unify set_state 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