Files
dioxus/examples
Miles MurgawandEvan Almloff 6210c6fefe Convert use_eval to use send/recv system (#1080)
* progress: reworked

don't run this, it'll kill your web browser

* feat: use_eval but with comms

* revision: async recv & recv_sync

* revision: use_eval

* revision: standard eval interface

* revision: use serde_json::Value instead of JsValue

* revision: docs

* revision: error message

* create: desktop eval (wip)

* fix: desktop eval

* revision: wrap use_eval in Rc<RefCell<_>>

* fix: fmt, clippy

* fix: desktop tests

* revision: change to channel system

- fixes clippy errors
- fixes playwright tests

* fix: tests

* fix: eval example

* fix: fmt

* fix: tests, desktop stuff

* fix: tests

* feat: drop handler

* fix: tests

* fix: rustfmt

* revision: web promise/callback system

* fix: recv error

* revision: IntoFuture, functionation

* fix: ci

* revision: playwright web

* remove: unescessary code

* remove dioxus-html from public examples

* prototype-patch

* fix web eval

* fix: rustfmt

* fix: CI

* make use_eval more efficient

* implement eval for liveview as well

* fix playwright tests

* fix clippy

* more clippy fixes

* fix clippy

* fix stack overflow

* fix desktop mock

* fix clippy

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
2023-07-21 17:36:25 -05:00
..
2023-07-05 15:19:26 -07:00
2023-07-14 13:58:49 -07:00
2023-02-06 22:18:07 -08:00
2023-01-27 20:35:46 -06:00
2023-01-27 20:35:46 -06:00
2023-01-27 20:35:46 -06:00
2023-04-09 13:42:40 -07:00
2023-06-02 12:33:47 -05:00
2023-01-15 10:12:22 -08:00
2023-01-27 20:35:46 -06:00
2023-01-27 20:35:46 -06:00
2023-06-02 12:33:47 -05:00
2023-04-23 17:15:06 +02:00
2023-06-02 12:33:47 -05:00
2022-11-15 16:37:23 -08:00
2023-01-01 14:41:18 -06:00
2023-03-26 07:23:32 -05:00
2023-06-30 13:31:59 +02:00
2022-12-30 02:09:02 -05:00
2023-07-18 16:34:27 -07:00
2023-01-27 20:35:46 -06:00
2023-03-24 11:32:42 -05:00
2023-07-14 16:34:49 -07:00
2023-06-30 12:48:25 -07:00
2023-07-14 12:52:49 -07:00
2023-06-02 12:33:47 -05:00
2023-01-27 20:35:46 -06:00
2023-04-22 11:09:41 -05:00
2023-01-27 20:35:46 -06:00
2023-04-02 20:03:33 -05:00
2023-03-19 20:47:16 -05:00
2023-01-01 14:41:18 -06:00
2023-07-04 14:48:05 +02:00
2022-12-30 02:32:53 -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_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

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