Crate flams_router_vscode Copy item path Source codee Easy and flexible way of encoding and decoding data into either strings or bytes. components errors guards Guards that integrate with the reactive system, wrapping references to the values of signals. server_fn Server Functions suspense Utilities used to track whether asynchronous computeds are currently loading. include_view This behaves like the view
macro, but loads the view from an external file instead of
parsing it inline. memo Generates a memo
into a struct with a default getter. slice Generates a slice
into a struct with a default getter and setter. template The template
macro behaves like view
, except that it wraps the entire tree in a
ViewTemplate
. This optimizes creation speed by rendering
most of the view into a <template>
tag with HTML rendered at compile time, then hydrating it.
In exchange, there is a small binary size overhead. view The view
macro uses RSX (like JSX, but Rust!) It follows most of the
same rules as HTML, with the following differences: Action An action runs some asynchronous code when you dispatch a new value to it, and gives you
reactive access to the result. ActionAbortHandle A handle that allows aborting an in-flight action. It is returned from Action::dispatch
or
ArcAction::dispatch
. ActionFormProps Props for the ActionForm
component. AnimatedShowProps Props for the AnimatedShow
component. AnimationFrameRequestHandle Handle that is generated by request_animation_frame_with_handle and can
be used to cancel the animation frame request. AnyView A type-erased view. This can be used if control flow requires that multiple different types of
view must be received, and it is either impossible or too cumbersome to use the EitherOf___
enums. ArcAction An action runs some asynchronous code when you dispatch a new value to it, and gives you
reactive access to the result. ArcAsyncDerived A reactive value that is derived by running an asynchronous computation in response to changes
in its sources. ArcLocalResource A reference-counted resource that only loads its data locally on the client. ArcMappedSignal A derived signal type that wraps an ArcRwSignal
with a mapping function,
allowing you to read or write directly to one of its field. ArcMemo An efficient derived reactive value based on other reactive values. ArcMultiAction An action that synchronizes multiple imperative async
calls to the reactive system,
tracking the progress of each one. ArcOnceResource A reference-counted resource that only loads once. ArcReadSignal A reference-counted getter for a reactive signal. ArcResource A reference-counted asynchronous resource. ArcRwSignal A reference-counted signal that can be read from or written to. ArcServerAction An ArcAction
that can be used to call a server function. ArcServerMultiAction An ArcMultiAction
that can be used to call a server function. ArcSignal A wrapper for any kind of reference-counted reactive signal:
an ArcReadSignal
, ArcMemo
, ArcRwSignal
, or derived signal closure,
or a plain value of the same type ArcStoredValue A reference-counted getter for any value non-reactively. ArcSubmission An action that has been submitted by dispatching it to a MultiAction
. ArcTrigger A trigger is a data-less signal with the sole purpose of notifying other reactive code of a change. ArcWriteSignal A reference-counted setter for a reactive signal. ArenaItem A copyable, stable reference for any value, stored on the arena whose ownership is managed by the
reactive ownership tree. AsyncDerived A reactive value that is derived by running an asynchronous computation in response to changes
in its sources. AsyncDerivedFuture A Future
that is ready when an ArcAsyncDerived
is finished loading or reloading,
and contains its value. .await
ing this clones the value T
. AsyncDerivedReadyFuture A Future
that is ready when an ArcAsyncDerived
is finished loading or reloading,
but does not contain its value. AsyncDerivedRefFuture A Future
that is ready when an ArcAsyncDerived
is finished loading or reloading,
and yields an AsyncDerivedGuard
that dereferences to its value. AutoReloadProps Props for the AutoReload
component. AwaitProps Props for the Await
component. Callback Callbacks define a standard way to store functions and closures. ChildrenOptContainer Compiler optimisation, can be used with certain type to avoid unique closures in the view!{} macro. ConfFile A Struct to allow us to parse LeptosOptions from the file. Not really needed, most interactions should
occur with LeptosOptions Dom A Renderer
that uses web-sys
to manipulate DOM elements in the browser. DoubleDeref A wrapper for a smart pointer that implements Deref
and DerefMut
by dereferencing the type inside the smart pointer. Effect Effects run a certain chunk of code whenever the signals they depend on change. Error A generic wrapper for any error. ErrorBoundaryProps Props for the ErrorBoundary
component. ErrorHookFuture A Future
that reads the error hook that is set when it is created, and sets this as the
current error hook whenever it is polled. ErrorId A unique identifier for an error. This is returned when you call throw
, which calls a
global error handler. Errors A struct to hold all the possible errors that could be provided by child Views ForEnumerateProps Props for the ForEnumerate
component. ForProps Props for the For
component. Fragment A typed-erased collection of different views. HydrationScriptsProps Props for the HydrationScripts
component. IdleCallbackHandle Handle that is generated by request_idle_callback_with_handle and can be
used to cancel the idle callback. ImmediateEffect Effects run a certain chunk of code whenever the signals they depend on change. IntervalHandle Handle that is generated by set_interval and can be used to clear the interval. IntoIter An owning iterator over all the errors contained in the Errors
struct. IsLsp đź”’ Serialized arguments for the is_lsp
server function. IslandsRouterNavigation If this is provided via context, it means that you are using the islands router and
this is a subsequent navigation, made from the client. Iter An iterator over all the errors contained in the Errors
struct. LeptosOptions This struct serves as a convenient place to store details used for configuring Leptos.
It’s used in our actix and axum integrations to generate the
correct path for WASM, JS, and Websockets, as well as other configuration tasks.
It shares keys with cargo-leptos, to allow for easy interoperability LocalResource A resource that only loads its data locally on the client. LocalStorage A form of Storage
that stores the type with a wrapper that makes it Send + Sync
, but only
allows it to be accessed from the thread on which it was created. MappedSignal A derived signal type that wraps an RwSignal
with a mapping function,
allowing you to read or write directly to one of its field. MaybeProp A wrapping type for an optional component prop. Memo A memo is an efficient derived reactive value based on other reactive values. MultiAction An action that synchronizes multiple imperative async
calls to the reactive system,
tracking the progress of each one. MultiActionFormProps Props for the MultiActionForm
component. NoParam Marker for no parameter functions NodeRef A reactive reference to a DOM node that can be used with the node_ref
attribute. Nonce A cryptographic nonce (“number used once”) which can be
used by Content Security Policy to determine whether or not a given
resource will be allowed to load. OnceResource A resource that only loads once. OnceResourceFuture A Future
that is ready when an
ArcAsyncDerived
is finished loading or reloading,
and contains its value. .await
ing this clones the value T
. Owner A reactive owner, which manages ReadSignal An arena-allocated getter for a reactive signal. RenderEffect A render effect is similar to an Effect
, but with two key differences: ResetErrorHookOnDrop Resets the error hook to its previous state when dropped. Resource An asynchronous resource. RwSignal An arena-allocated signal that can be read from or written to. Sandboxed A Future
that restores its associated arena as the current arena whenever it is
polled. ScopedFuture A Future
wrapper that sets the Owner
and [Observer
] before polling the inner
Future
. Selector A conditional signal that only notifies subscribers when a change
in the source signal’s value changes whether the given function is true. ServerAction An Action
that can be used to call a server function. ServerActionError An error that can be caused by a server action. ServerMultiAction A MultiAction
that can be used to call a server function. SharedValue A smart pointer that allows you to share identical, synchronously-loaded data between the
server and the client. ShowProps Props for the Show
component. Signal A wrapper for any kind of arena-allocated reactive signal:
a ReadSignal
, Memo
, RwSignal
, or derived signal closure,
or a plain value of the same type SignalSetter A wrapper for any kind of settable reactive signal: a WriteSignal
,
RwSignal
, or closure that receives a value and sets a signal depending
on it. SingleParam Marker for single parameter functions StoredValue A non-reactive , Copy
handle for any value. Submission An action that has been submitted by dispatching it to a MultiAction
. SuppressResourceLoad Used to prevent resources from actually loading, in environments (like server route generation)
where they are not needed. Suspend A suspended Future
, which can be used in the view. SuspenseProps Props for the Suspense
component. SyncStorage A form of Storage
that stores the type as itself, with no wrapper. TextProp Describes a value that is either a static or a reactive string, i.e.,
a String
, a &str
, a Signal
or a reactive Fn() -> String
. TimeoutHandle Handle that is generated by set_timeout_with_handle and can be used to clear the timeout. TransitionProps Props for the Transition
component. Trigger A trigger is a data-less signal with the sole purpose of notifying other reactive code of a change. TypedChildren A typed equivalent to Children
, which takes a generic but preserves type information to
allow the compiler to optimize the view more effectively. TypedChildrenFn A typed equivalent to ChildrenFn
, which takes a generic but preserves type information to
allow the compiler to optimize the view more effectively. TypedChildrenMut A typed equivalent to ChildrenFnMut
, which takes a generic but preserves type information to
allow the compiler to optimize the view more effectively. UnmountHandle On drop, this will clean up the reactive Owner
and unmount the view created by
mount_to
. Unsuspend A wrapper that prevents Suspense
from waiting for any resource reads that happen inside
Unsuspend
. UnsyncCallback A callback type that is not required to be Send + Sync
. VSCode VSCodeWrapProps Props for the VSCodeWrap
component. View A wrapper for any kind of view. ViewFn New-type wrapper for a function that returns a view with From
and Default
traits implemented
to enable optional props in for example <Show>
and <Suspense>
. ViewFnOnce New-type wrapper for a function, which will only be called once and returns a view with From
and
Default
traits implemented to enable optional props in for example <Show>
and <Suspense>
. ViewTemplate A view wrapper that uses a <template>
node to optimize DOM node creation. WindowListenerHandle A handle that can be called to remove a global event listener. WriteSignal An arena-allocated setter for a reactive signal. Env An enum that can be used to define the environment Leptos is running in.
Setting this to the PROD
variant will not include the WebSocket code for cargo-leptos
watch mode.
Defaults to DEV
. FromFormDataError Errors that can arise when converting from an HTML event or form into a Rust data type. FromUtf8Error Error returned from Oco::try_from
for unsuccessful
conversion from Oco<'_, [u8]>
to Oco<'_, str>
. MaybeSignal Deprecated A wrapper for a value that is either T
or Signal<T>
. Oco “Owned Clones Once”: a smart pointer that can be either a reference,
an owned value, or a reference-counted pointer. This is useful for
storing immutable values, such as strings, in a way that is cheap to
clone and pass around. ReloadWSProtocol An enum that can be used to define the websocket protocol Leptos uses for hotreloading
Defaults to ws
. ServerFnError A type that can be used as the return type of the server function for easy error conversion with ?
operator.
This type can be replaced with any other error type that implements FromServerFnError
. ServerFnErrorErr Type for errors that can occur when using server functions. If you need to return a custom error type from a server function, implement FromServerFnError
for your custom error type. SignalReadGuard The content of a Signal
wrapper read guard, variable depending on the signal type. SignalTypes Possibilities for the inner type of a Signal
. AddAnyAttr Allows adding a new attribute to some type, before it is rendered.
This takes place at compile time as part of the builder syntax for creating a statically typed
view tree. AriaAttributes Applies ARIA attributes to an HTML element. BindAttribute Adds a two-way binding to the element, which adds an attribute and an event listener to the
element when the element is created or hydrated. Callable A wrapper trait for calling callbacks. ClassAttribute Adds an attribute that modifies the class
. CollectView Collects some iterator of views into a list, so they can be rendered. Component ComponentConstructor CustomAttribute Adds a custom attribute to an element. DefinedAt Describes where the signal was defined. This is used for diagnostic warnings and is purely a
debug-mode tool. DirectiveAttribute Adds a directive to the element, which runs some custom logic in the browser when the element
is created or hydrated. Dispose Allows disposing an arena-allocated signal before its owner has been disposed. EffectFunction Trait to enable effect functions that have zero or one parameter ElementChild Adds a child to the element. ElementExt Extends an HTML element, allowing you to add attributes and children to the
element’s built state at runtime, with a similar API to how they
can be added to the static view tree at compile time. ErrorHook Implements behavior that allows for global or scoped error handling. FlattenOptionRefOption Helper trait to implement flatten() on Option<&Option<T>>
. FromEncodedStr Decodes data from a string. FromFormData Tries to deserialize a type from form data. This can be used for client-side
validation during form submission. FromLocal Converts some value into a locally-stored type, using LocalStorage
. FromServerFnError A trait for types that can be returned from a server function. FromStream Allows creating a signal from an async [Stream
]. Get Clones the value of the signal, without tracking the value reactively.
and subscribes the active reactive observer (an effect or computed) to changes in its value. GetUntracked Clones the value of the signal, without tracking the value reactively. GetValue A variation of the Get
trait that provides a signposted “always-non-reactive” API.
E.g. for StoredValue
. GlobalAttributes Global attributes can be added to any HTML element. GlobalOnAttributes Provides methods for HTML event listener attributes. InnerHtmlAttribute Sets the inner HTML of an element. IntoAny Allows converting some view into AnyView
. IntoAnyAttribute Converts an [Attribute
] into [AnyAttribute
]. IntoAttributeValue Declares that this type can be converted into some other type, which is a valid attribute value. IntoEncodedString Encodes data into a string. IntoInner Turns a signal back into a raw value. IntoMaybeErased A more general version of IntoAny
that allows into AnyView
,
but also erasing other types that don’t implement RenderHtml
like routing. IntoRender Declares that this type can be converted into some other type, which can be rendered. IntoSignalSetter Helper trait for converting Fn(T)
into SignalSetter<T>
. IntoView A trait that is implemented for types that can be rendered. IsDisposed Checks whether a signal has already been disposed. Mountable Allows a type to be mounted to the DOM. NodeRefAttribute Adds the node_ref
attribute to an element. Notify Notifies subscribers of a change in this signal. OnAttribute Adds an event listener to an element definition. OnTargetAttribute Adds an event listener with a typed target to an element definition. OptionTextPropExt Extension trait for Option<TextProp>
PropAttribute Adds an attribute that modifies the DOM properties. Props Read Give read-only access to a signal’s value by reference through a guard type,
and subscribes the active reactive observer (an effect or computed) to changes in its value. ReadOptional An alternative Read
trait that works with Option<Readable>
types. ReadUntracked Give read-only access to a signal’s value by reference through a guard type,
without tracking the value reactively. ReadUntrackedOptional An alternative ReadUntracked
trait that works with Option<Readable>
types. ReadValue A variation of the Read
trait that provides a signposted “always-non-reactive” API.
E.g. for StoredValue
. Render The Render
trait allows rendering something as part of the user interface. RenderHtml The RenderHtml
trait allows rendering something to HTML, and transforming
that HTML into an interactive interface. Renderer Implements the instructions necessary to render an interface on some platform. Set Updates the value of the signal by replacing it. SetValue A variation of the Set
trait that provides a signposted “always-non-reactive” API.
E.g. for StoredValue
. Storage A way of storing an ArenaItem
, either as itself or with a wrapper to make it threadsafe. StorageAccess A trait for borrowing and taking data. StyleAttribute Adds an attribute that modifies the CSS styles. ToChildren This trait can be used when constructing a component that takes children without needing
to know exactly what children type the component expects. This is used internally by the
view!
macro implementation, and can also be used explicitly when using the builder syntax. ToStream Allows converting a signal into an async [Stream
]. Track Allows tracking the value of some reactive data. UntrackableGuard A reactive, mutable guard that can be untracked to prevent it from notifying subscribers when
it is dropped. Update Updates the value of a signal by applying a function that updates it in place,
notifying its subscribers that the value has changed. UpdateUntracked Updates the value of a signal by applying a function that updates it in place,
without notifying subscribers. UpdateValue A variation of the Update
trait that provides a signposted “always-non-reactive” API.
E.g. for StoredValue
. With Give read-only access to a signal’s value by reference inside a closure,
and subscribes the active reactive observer (an effect or computed) to changes in its value. WithOptional An alternative With
trait that works with Option<Withable>
types. WithUntracked Give read-only access to a signal’s value by reference inside a closure,
without tracking the value reactively. WithUntrackedOptional An alternative WithUntracked
trait that works with Option<Withable>
types. WithValue A variation of the With
trait that provides a signposted “always-non-reactive” API.
E.g. for StoredValue
. Write Gives mutable access to a signal’s value through a guard type. When the guard is dropped, the
signal’s subscribers will be notified. WriteValue A variation of the Write
trait that provides a signposted “always-non-reactive” API.
E.g. for StoredValue
. ActionForm Automatically turns a server Action into an HTML
form
progressively enhanced to use client-side routing. AnimatedShow A component that will show its children when the when
condition is true
.
Additionally, you need to specify a hide_delay
. If the when
condition changes to false
,
the unmounting of the children will be delayed by the specified Duration.
If you provide the optional show_class
and hide_class
, you can create very easy mount /
unmount animations. AutoReload Inserts auto-reloading code used in cargo-leptos
. Await Allows you to inline the data loading for an async
block or
server function directly into your view. This is the equivalent of combining a
[create_resource
] that only loads once (i.e., with a source signal || ()
) with
a Suspense
with no fallback
. ErrorBoundary When you render a Result<_, _>
in your view, in the Err
case it will
render nothing, and search up through the view tree for an <ErrorBoundary/>
.
This component lets you define a fallback that should be rendered in that
error case, allowing you to handle errors within a section of the interface. For Iterates over children and displays them, keyed by the key
function given. ForEnumerate Iterates over children and displays them, keyed by the key
function given. HydrationScripts Inserts hydration scripts that add interactivity to your server-rendered HTML. MultiActionForm Automatically turns a server MultiAction into an HTML
form
progressively enhanced to use client-side routing. Show Required Props Suspense If any Resource
is read in the children
of this
component, it will show the fallback
while they are loading. Once all are resolved,
it will render the children
. Transition If any Resource
is read in the children
of this
component, it will show the fallback
while they are loading. Once all are resolved,
it will render the children
. VSCodeWrap arc_signal Creates a reference-counted signal. clear Clears the given error from the current error hook. component_props_builder component_view create_action Deprecated Creates a new action. This is lazy: it does not run the action function until some value
is dispatched. create_effect Deprecated Creates an Effect
. create_memo Deprecated Creates a new memoized, computed reactive value. create_node_ref Deprecated Create a NodeRef . create_owning_memo Deprecated Creates a new memo by passing a function that computes the value. create_read_slice Takes a memoized, read-only slice of a signal. This is equivalent to the
read-only half of create_slice
. create_render_effect Deprecated Creates a new render effect, which immediately runs fun
. create_rw_signal Deprecated Creates a reactive signal with the getter and setter unified in one value. create_selector Deprecated A conditional signal that only notifies subscribers when a change
in the source signal’s value changes whether the given function is true. create_selector_with_fn Deprecated Creates a conditional signal that only notifies subscribers when a change
in the source signal’s value changes whether the given function is true. create_signal Deprecated Creates an arena-allocated signal, the basic reactive primitive. create_slice Derives a reactive slice of an RwSignal
. create_trigger Deprecated A trigger is a data-less signal with the sole purpose of notifying other reactive code of a change. create_write_slice Creates a setter to access one slice of a signal. This is equivalent to the
write-only half of create_slice
. debounce “Debounce” a callback function. This will cause it to wait for a period of delay
after it is called. If it is called again during that period, it will wait
delay
before running, and so on. This can be used, for example, to wrap event
listeners to prevent them from firing constantly as you type. document Returns the Document
. event_target Helper function to extract Event.target
from any event. event_target_checked Helper function to extract event.target.checked
from an event. event_target_value Helper function to extract event.target.value
from an event. expect_context Extracts a context value of type T
from the reactive system, and
panics if it can’t be found. get_config_from_env Loads LeptosOptions from environment variables or rely on the defaults get_config_from_file Loads LeptosOptions from a Cargo.toml with layered overrides. Leptos will read in the settings itself. This
option currently does not allow dashes in file or folder names, as all dashes become underscores get_config_from_str Loads LeptosOptions from a Cargo.toml text content with layered overrides.
If an env var is specified, like LEPTOS_ENV
, it will override a setting in the file. get_configuration Loads LeptosOptions from a Cargo.toml with layered overrides. If an env var is specified, like LEPTOS_ENV
,
it will override a setting in the file. It takes in an optional path to a Cargo.toml file. If None is provided,
you’ll need to set the options as environment variables or rely on the defaults. This is the preferred
approach for cargo-leptos. If Some(“./Cargo.toml”) is provided, Leptos will read in the settings itself. This
option currently does not allow dashes in file or folder names, as all dashes become underscores get_error_hook Returns the current error hook. hydrate_body Hydrates the app described by the provided function, starting at <body>
. hydrate_from Runs the provided closure and mounts the result to the provided element. hydrate_from_async Runs the provided closure and mounts the result to the provided element. hydrate_islands Hydrates any islands that are currently present on the page. hydrate_lazy Hydrates the app described by the provided function, starting at <body>
, with support
for lazy-loaded routes and components. in_effect_scope Returns whether the current thread is currently running an effect. is_lsp đź”’ location Returns the current window.location
. location_hash Current window.location.hash
without the beginning #. location_pathname Current window.location.pathname
. mount_to Runs the provided closure and mounts the result to the provided element. mount_to_body Runs the provided closure and mounts the result to the <body>
. mount_to_renderer Runs the provided closure and mounts the result to the provided element. on_cleanup Registers a function to be run the next time the current owner is cleaned up. provide_context Provides a context value of type T
to the current reactive Owner
and all of its descendants. This can be accessed using use_context
. provide_nonce Generates a nonce and provides it via context. queue_microtask A microtask is a short function which will run after the current task has
completed its work and when there is no other code waiting to be run before
control of the execution context is returned to the browser’s event loop. request_animation_frame Runs the given function between the next repaint using
Window.requestAnimationFrame
. request_animation_frame_with_handle Runs the given function between the next repaint using
Window.requestAnimationFrame
,
returning a cancelable handle. request_idle_callback Queues the given function during an idle period using
Window.requestIdleCallback
. request_idle_callback_with_handle Queues the given function during an idle period using
Window.requestIdleCallback
,
returning a cancelable handle. set_error_hook Sets the current thread-local error hook, which will be invoked when throw
is called. set_interval Repeatedly calls the given function, with a delay of the given duration between calls.
See setInterval()
. set_interval_with_handle Repeatedly calls the given function, with a delay of the given duration between calls,
returning a cancelable handle.
See setInterval()
. set_property Sets a property on a DOM element. set_timeout Executes the given function after the given duration of time has passed.
setTimeout()
. set_timeout_with_handle Executes the given function after the given duration of time has passed, returning a cancelable handle.
setTimeout()
. signal Creates an arena-allocated signal, the basic reactive primitive. signal_local Creates an arena-allocated signal. store_value Deprecated Creates a new StoredValue
. take_context Extracts a context value of type T
from the reactive system, and takes ownership,
removing it from the context system. throw Invokes the error hook set by set_error_hook
with the given error. untrack Suspends reactive tracking while running the given function. update_context Update a context value of type T
in the reactive system. use_context Extracts a context value of type T
from the reactive system. use_nonce Accesses the nonce that has been generated during the current
server response. This can be added to inline <script>
and
<style>
tags for compatibility with a Content Security Policy. watch Deprecated Creates an Effect
, equivalent to Effect::watch . window Returns the Window
. window_event_listener Creates a window event listener from a typed event, returning a
cancelable handle. window_event_listener_untyped Adds an event listener to the Window
, typed as a generic Event
,
returning a cancelable handle. with_context Access a reference to a context value of type T
in the reactive system. AsyncDerivedGuard A read guard that holds access to an async derived resource. Children The most common type for the children
property on components,
which can only be called once. ChildrenFn A type for the children
property on components that can be called
more than once. ChildrenFnMut A type for the children
property on components that can be called
more than once, but may mutate the children. ChildrenFragment A type for the children
property on components that can be called only once,
and provides a collection of all the children passed to this component. ChildrenFragmentFn A type for the children
property on components that can be called more than once,
and provides a collection of all the children passed to this component. ChildrenFragmentMut A type for the children
property on components that can be called more than once,
but may mutate the children, and provides a collection of all the children
passed to this component. component Annotates a function so that it can be used with your template as a Leptos <Component/>
. island Defines a component as an interactive island when you are using the
islands
feature of Leptos. Apart from the macro name,
the API is the same as the component
macro. lazy The #[lazy]
macro indicates that a function can be lazy-loaded from a separate WebAssembly (WASM) binary. server Declares that a function is a server function .
This means that its body will only run on the server, i.e., when the ssr
feature on this crate is enabled. slot Annotates a struct so that it can be used with your Component as a slot
. Params Derives a trait that parses a map of string keys and values into a typed
data structure, e.g., for route params.