Module freya::prelude

source ·
Expand description

Useful imports.

Re-exports§

  • pub use dioxus_core;
  • pub use dioxus_hot_reload;
  • pub use freya_elements as dioxus_elements;
  • pub use crate::launch::*;
  • pub use crate::plugins::*;

Modules§

Macros§

  • Alias for Cow::Borrowed, because that’s used a million times so shortening it is nice. Makes the code more readable.
  • This macro is used to generate a impl Default block for any type with the function new_maybe_sync that takes a generic T
  • Example usage:
  • This macro is used to generate impl PartialEq blocks for any Readable type that takes a generic T
  • This macro is used to generate impl Display, and impl Debug blocks for any Readable type that takes a generic T
  • Generate a Dioxus component rendering the specified SVG.
  • This macro is used to generate impl Display, impl Debug, impl PartialEq, and impl Eq blocks for any Readable type that takes a generic T
  • The rsx! macro makes it easy for developers to write jsx-style markup in their components.
  • Create FooThemeWith structs without having to deal with the verbose syntax.
  • A helper macro for cloning multiple values at once
  • This macro has three arguments separator by commas.
  • A helper macro for use_reactive that merges uses the closure syntax to elaborate the dependency array
  • This macro is used to generate impl Add, impl AddAssign, impl Sub, impl SubAssign, impl Mul, impl MulAssign, impl Div, and impl DivAssign blocks for any Writable type that takes a generic T

Structs§

Enums§

Constants§

Traits§

  • A trait for any storage backing type.
  • Any component that implements the ComponentFn trait can be used as a component.
  • Provides context methods to [Result] and Option types that are compatible with [CapturedError]
  • A trait for giving a type a useful default value.
  • A dependency is a trait that can be used to determine if a effect or selector should be re-run.
  • A dependency is a trait that can be used to determine if a effect or selector should be re-run.
  • A trait for anything that has a dynamic list of attributes
  • A value that can be converted into an attribute value
  • A trait that allows various items to be converted into a dynamic node for the rsx macro
  • Abstract the path matching.
  • Every “Props” used for a component must implement the Properties trait. This trait gives some hints to Dioxus on how to memoize the props and some additional optimizations that can be made. We strongly encourage using the derive macro to implement the Properties trait automatically.
  • A trait for states that can be read from like crate::Signal, crate::GlobalSignal, or crate::ReadOnlySignal. You may choose to accept this trait as a parameter instead of the concrete type to allow for more flexibility in your API. For example, instead of creating two functions, one that accepts a crate::Signal and one that accepts a crate::GlobalSignal, you can create one function that accepts a Readable type.
  • An extension trait for Readable<Option> that provides some convenience methods.
  • An extension trait for Readable<Option> that provides some convenience methods.
  • An extension trait for Readable<Vec> that provides some convenience methods.
  • A trait for a storage backing type. (RefCell, RwLock, etc.)
  • A enhanced version of the From trait that allows with more flexibility.
  • A enhanced version of the Into trait that allows with more flexibility.
  • Provides context methods to [Result<T, RenderError>] to show loading indicators for suspended results
  • Common trait for editable texts
  • A trait for states that can be written to like crate::Signal. You may choose to accept this trait as a parameter instead of the concrete type to allow for more flexibility in your API.
  • An extension trait for Writable<Option<T>>` that provides some convenience methods.
  • An extension trait for Writable<Vec<T>> that provides some convenience methods.

Functions§

  • Show other elements under a collapsable box.
  • Intended to wrap the body of an Accordion.
  • Intended to use as summary for an Accordion.
  • Provide a context to the inner components so they can know whether the passed route is the current router in the Router or not.
  • Provide a mechanism for outlets to animate between route transitions.
  • Icon component for an Arrow.
  • Usually used to wrap the application root component.
  • Clickable BottomTab. Same thing as Tab but designed to be placed in the bottom of your app, usually used in combination with [Tabsbar], [Link] and [ActivableRoute].
  • Clickable button.
  • Draw anything inside of this canvas.
  • Controlled Checkbox component.
  • Icon component for a Cross.
  • Change the cursor icon when it’s hovering over this component.
  • Provide a common place for DragZones and DropZones to exchange their data.
  • Make the inner children draggable to other DropZone.
  • Elements from DragZones can be dropped here.
  • Select from multiple options, use alongside DropdownItem.
  • Styling
  • Create a new error boundary component that catches any errors thrown from child components
  • Create inline fragments using Component syntax.
  • Detect complex touch gestures such as Gesture::DoubleTap.
  • Graph component.
  • Small box to edit text.
  • Similar to Link, but you can use it in Freya. Both internal routes (dioxus-router) and external links are supported. When using internal routes make sure the Link is descendant of a Router component.
  • Styling
  • Floating menu, use alongside [MenuItem].
  • Like a button, but for [Menu]s.
  • Wraps the body of a [Menu].
  • Styling
  • Props
  • Provides native functionalities for a dioxus-router.
  • Image component that automatically fetches and caches remote (HTTP) images.
  • Floating window intended for quick interactions. Also called Dialog in other frameworks.
  • The background of the [Popup] component.
  • Optionally wrap the content of your [Popup] in a styled container.
  • Optionally use a styled title inside a [Popup].
  • Display the progress of something visually. For example: downloading files, fetching data, etc.
  • Controlled Radio component.
  • Scroll thumb used for crate::ScrollView and crate::VirtualScrollView.
  • Scrollable area with bidirectional support and scrollbars.
  • Props
  • Props
  • Controlled Slider component.
  • SnackBar component. Use in combination with other components.
  • Create sub menus inside a [Menu].
  • Suspense Boundaries let you render a fallback UI while a child component is suspended.
  • Display whether a state is true or false. Commonly used for enabled/disabled scenarios. Example: light/dark theme.
  • Clickable Tab. Usually used in combination with [Tabsbar], [Link] and [ActivableRoute].
  • Table component, composed with TableHead and TableBody.
  • The body of a Table.
  • Cell for a Table. You can place anything inside.
  • The head of a Table. Use TableRow inside.
  • Table row for Table. Use TableCell inside.
  • Horizontal container for Tabs. Use in combination with [Tab]
  • Provides a Theme for all its children.
  • Icon component for a Tick.
  • Tile component to be used with [Radio] and [Checkbox].
  • Tooltip component
  • One-direction scrollable area that dynamically builds and renders items based in their size and current available size, this is intended for apps using large sets of data that need good performance.
  • Allow dragging the window when the cursor drag this component with a left mouse click.
  • Consume context from the current scope
  • Consume context from the current scope
  • Returns the current owner. This owner will be used to drop any Copy state that is created by the generational-box crate.
  • Get the current scope id
  • Transform some dynamic bytes (e.g: remote image fetched at runtime) into an attribute
  • This utility function launches the builder method so rsx! and html! macros can use the typed-builder pattern to initialize a component’s props.
  • Get the current render since the inception of this component
  • Get the global context for signals
  • Check if the current scope has a context
  • Return the equivalent Winit’s Key in keyboard_types
  • Return the equivalent of Winit’s PhysicalKey in keyboard_types
  • Mark the current scope as dirty, causing it to re-render
  • Mark the current scope as dirty, causing it to re-render
  • The click event fires when the user clicks an element with the left button of the mouse.
  • The filedrop event fires when the user drops a file over the element.
  • The globalclick event fires when the user clicks anywhere. Note that this fires for all mouse buttons. You can check the specific variant with the MouseData’s trigger_button property.
  • The onglobalfilehover event fires when the user hovers a file over the window.
  • The onglobalfilehovercancelled event fires when the user cancels the hovering of a file over the window. It’s the opposite of onglobalfilehover.
  • The globalmousedown event fires when the user starts clicking anywhere. Note that this fires for all mouse buttons. You can check the specific variant with the MouseData’s trigger_button property.
  • The globalmouseover event fires when the user moves the mouse anywhere in the app.
  • The globalpointerup event fires when the user releases the point anywhere in the app.
  • The keydown event fires when the user starts pressing any key.
  • The keyup event fires when the user releases any key being pressed.
  • The click event fires when the user clicks an element with the middle button of the mouse.
  • The mousedown event fires when the user starts clicking an element. Note that this fires for all mouse buttons. You can check the specific variant with the MouseData’s trigger_button property.
  • The mouseenter event fires when the user starts hovering an element.
  • The mouseleave event fires when the user stops hovering an element.
  • The mouseover event fires when the user moves the mouse over an element. Unlike onmouseover, this fires even if the user was already hovering over the element. For that reason, it’s less efficient.
  • The pointerdown event fires when the user clicks/starts touching an element.
  • The pointerenter event fires when the user starts hovering/touching an element.
  • The pointerleave event fires when the user stops hovering/touching an element.
  • The pointerover event fires when the user hovers/touches over an element. Unlike onpointerenter, this fires even if the user was already hovering over the element. For that reason, it’s less efficient.
  • The pointerup event fires when the user releases their mouse button or stops touching the element.
  • The click event fires when the user clicks an element with the right button of the mouse.
  • The touchcancel event fires when the user cancels the touching, this is usually caused by the hardware or the OS. Also see ontouchend.
  • The touchend event fires when the user stops touching an element.
  • The touchmove event fires when the user is touching over an element.
  • The touchstart event fires when the user starts touching an element.
  • The wheel event fires when the user scrolls the mouse wheel while hovering over the element.
  • Get the parent of the current scope if it exists
  • Provide context to the current scope
  • Provide an error boundary to catch errors from child components
  • Provide a context to the root scope
  • Queue an effect to run after the next render. You generally shouldn’t need to interact with this function directly. use_effect will call this function for you.
  • Informs the scheduler that this task is no longer needed and should be removed.
  • Calculate some chained operations with a given value. This value could be for example the width of a node’s parent area.
  • Schedule an update for the current component
  • Schedule an update for any component given its ScopeId.
  • Spawns the future but does not return the Task. This task will automatically be canceled when the component is dropped.
  • Spawn a future that Dioxus won’t clean up when this component is unmounted
  • Start a new future on the same thread as the rest of the VirtualDom.
  • Transform some static bytes (e.g: statically linked images or SVGs) into an attribute
  • Suspended the current component on a specific task and then return None
  • Throw a [CapturedError] into the current scope. The error will bubble up to the nearest crate::prelude::ErrorBoundary() or the root of the app.
  • Consume context from the current scope
  • Consume some context in the tree, providing a sharable handle to the value
  • Push this function to be run after the next render
  • Shortcut to get access to the AnimatedRouterContext.
  • Animate your elements easily.
  • Global caching system for assets.
  • A hook that allows you to insert a “before render” function.
  • A callback that’s always current
  • Register a rendering hook to gain access to the Canvas. Reactivity managed through signals.
  • Register a rendering hook to gain access to the Canvas. Reactivity managed with manual dependencies.
  • Consume some context in the tree, providing a sharable handle to the value
  • Provide some context via the tree and return a reference to it
  • Maintain a handle over a future that can be paused, resumed, and canceled.
  • Get a handle to a coroutine higher in the tree Analogous to use_context_provider and use_context, but used for coroutines specifically See the docs for use_coroutine for more details.
  • Creates a callback that will be run before the component is removed. This can be used to clean up side effects from the component (created with use_effect).
  • Create a virtual text editor with it’s own cursor and rope.
  • Effects are reactive closures that run after the component has finished rendering. Effects are useful for things like manually updating the DOM after it is rendered with web-sys or javascript. Or reading a value from the rendered DOM.
  • Create a focus manager for a node.
  • Create a Form controller with a submit callback.
  • A hook that allows you to spawn a future the first time you render a component.
  • Subscribe to Theme changes, default theme will be used if there is no provided Theme.
  • Store a value between renders. The foundational hook for all other hooks.
  • A hook that uses before/after lifecycle hooks to determine if the hook was run
  • Use a hook with a cleanup function
  • Initialize the global caching system for assets.
  • Provide the default Theme.
  • Keep some native features (focused element, preferred theme, etc) on sync between the platform and the components
  • Provide a custom Theme.
  • Creates a new Memo. The memo will be run immediately and whenever any signal it reads is written to. Memos can be used to efficiently compute derived data from signals.
  • Subscribe to a Node layout changes.
  • Get a signal to read the latest layout from a Node.
  • use_on_unmountDeprecated
  • Get access to information and features of the platform.
  • Get access to information from the platform.
  • Access the preferred theme selected by the user.
  • Takes some non-reactive data, and a closure and returns a closure that will subscribe to that non-reactive data as if it were reactive.
  • use_resource() is a reactive hook that resolves to the result of a future. It will rerun when you write to any signals you read inside the future.
  • Try to get a value from the root of the virtual dom, if it doesn’t exist, create a new one with the closure provided.
  • Creates a new SetCompare which efficiently tracks when a value changes to check if it is equal to a set of values.
  • A hook that returns true if the value is equal to the value in the set compare.
  • Creates a new Signal. Signals are a Copy state management solution with automatic dependency tracking.
  • Creates a new `Send + Sync`` Signal. Signals are a Copy state management solution with automatic dependency tracking.
  • Subscribe to Theme changes.
  • Run a closure with the given owner.

Type Aliases§

Attribute Macros§

Derive Macros§

  • Derive macro generating an impl of the trait Default.
  • Props