Expand description
UI Kit prelude.
Re-exports§
pub use crate::setup_app;pub use console_error_panic_hook;pub use impulse_utils;pub use console_log;pub use log;
Modules§
- codee
- Easy and flexible way of encoding and decoding data into either strings or bytes.
- 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.
Macros§
- include_
view - This behaves like the
viewmacro, but loads the view from an external file instead of parsing it inline. - memo
- Generates a
memointo a struct with a default getter. - slice
- Generates a
sliceinto a struct with a default getter and setter. - template
- The
templatemacro behaves likeview, except that it wraps the entire tree in aViewTemplate. 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
viewmacro uses RSX (like JSX, but Rust!) It follows most of the same rules as HTML, with the following differences:
Structs§
- Action
- An action runs some asynchronous code when you dispatch a new value to it, and gives you reactive access to the result.
- Action
Abort Handle - A handle that allows aborting an in-flight action. It is returned from
Action::dispatchorArcAction::dispatch. - Action
Form Props - Props for the
ActionFormcomponent. - Animated
Show Props - Props for the
AnimatedShowcomponent. - Animation
Frame Request Handle - 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.
- ArcAsync
Derived - A reactive value that is derived by running an asynchronous computation in response to changes in its sources.
- ArcLocal
Resource - A reference-counted resource that only loads its data locally on the client.
- ArcMapped
Signal - A derived signal type that wraps an
ArcRwSignalwith 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.
- ArcMulti
Action - An action that synchronizes multiple imperative
asynccalls to the reactive system, tracking the progress of each one. - ArcOnce
Resource - A reference-counted resource that only loads once.
- ArcRead
Signal - A reference-counted getter for a reactive signal.
- ArcResource
- A reference-counted asynchronous resource.
- ArcRw
Signal - A reference-counted signal that can be read from or written to.
- ArcServer
Action - An
ArcActionthat can be used to call a server function. - ArcServer
Multi Action - An
ArcMultiActionthat 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 - ArcStored
Value - 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.
- ArcWrite
Signal - A reference-counted setter for a reactive signal.
- Arena
Item - A copyable, stable reference for any value, stored on the arena whose ownership is managed by the reactive ownership tree.
- Async
Derived - A reactive value that is derived by running an asynchronous computation in response to changes in its sources.
- Async
Derived Future - A
Futurethat is ready when anArcAsyncDerivedis finished loading or reloading, and contains its value..awaiting this clones the valueT. - Async
Derived Ready Future - A
Futurethat is ready when anArcAsyncDerivedis finished loading or reloading, but does not contain its value. - Async
Derived RefFuture - A
Futurethat is ready when anArcAsyncDerivedis finished loading or reloading, and yields anAsyncDerivedGuardthat dereferences to its value. - Auto
Reload Props - Props for the
AutoReloadcomponent. - Await
Props - Props for the
Awaitcomponent. - Callback
- Callbacks define a standard way to store functions and closures.
- Children
OptContainer - Compiler optimisation, can be used with certain type to avoid unique closures in the view!{} macro.
- Conf
File - A Struct to allow us to parse LeptosOptions from the file. Not really needed, most interactions should occur with LeptosOptions
- Dom
- A
Rendererthat usesweb-systo manipulate DOM elements in the browser. - Double
Deref - A wrapper for a smart pointer that implements
DerefandDerefMutby 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.
- Error
Boundary Props - Props for the
ErrorBoundarycomponent. - Error
Hook Future - A
Futurethat 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
- ForEnumerate
Props - Props for the
ForEnumeratecomponent. - ForProps
- Props for the
Forcomponent. - Fragment
- A typed-erased collection of different views.
- Function
Marker - Marker type for creating an
OptionGetterfrom a closure. Used so that the compiler doesn’t complain about double implementations of the traitIntoOptionGetter. - Hydration
Scripts Props - Props for the
HydrationScriptscomponent. - Idle
Callback Handle - Handle that is generated by request_idle_callback_with_handle and can be used to cancel the idle callback.
- Immediate
Effect - Effects run a certain chunk of code whenever the signals they depend on change.
- Interval
Handle - Handle that is generated by set_interval and can be used to clear the interval.
- Into
Iter - An owning iterator over all the errors contained in the
Errorsstruct. - Islands
Router Navigation - 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
Errorsstruct. - Leptos
Options - 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
- Local
Resource - A resource that only loads its data locally on the client.
- Local
Storage - A form of
Storagethat stores the type with a wrapper that makes itSend + Sync, but only allows it to be accessed from the thread on which it was created. - Mapped
Signal - A derived signal type that wraps an
RwSignalwith a mapping function, allowing you to read or write directly to one of its field. - Maybe
Prop - A wrapping type for an optional component prop.
- Memo
- A memo is an efficient derived reactive value based on other reactive values.
- Multi
Action - An action that synchronizes multiple imperative
asynccalls to the reactive system, tracking the progress of each one. - Multi
Action Form Props - Props for the
MultiActionFormcomponent. - NoParam
- Marker for no parameter functions
- NodeRef
- A reactive reference to a DOM node that can be used with the
node_refattribute. - Once
Resource - A resource that only loads once.
- Once
Resource Future - A
Futurethat is ready when anArcAsyncDerivedis finished loading or reloading, and contains its value..awaiting this clones the valueT. - Option
Getter - Servers as a wrapper for both, an
Optionsignal or a closure that returns anOption. - Owner
- A reactive owner, which manages
- Read
Signal - An arena-allocated getter for a reactive signal.
- Render
Effect - A render effect is similar to an
Effect, but with two key differences: - Reset
Error Hook OnDrop - 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.
- Scoped
Future - A
Futurewrapper that sets theOwnerandObserverbefore polling the innerFuture. - Scoped
Future Untracked With Diagnostics - A
Futurewrapper that sets theOwnerandObserverbefore polling the innerFuture, output ofScopedFuture::new_untracked_with_diagnostics. - Selector
- A conditional signal that only notifies subscribers when a change in the source signal’s value changes whether the given function is true.
- Server
Action - An
Actionthat can be used to call a server function. - Server
Action Error - An error that can be caused by a server action.
- Server
Multi Action - A
MultiActionthat can be used to call a server function. - Shared
Value - A smart pointer that allows you to share identical, synchronously-loaded data between the server and the client.
- Show
LetProps - Props for the
ShowLetcomponent. - Show
Props - Props for the
Showcomponent. - 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 - Signal
Marker - Marker type for creating an
OptionGetterfrom a signal. Used so that the compiler doesn’t complain about double implementations of the traitIntoOptionGetter. - Signal
Setter - 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. - Single
Param - Marker for single parameter functions
- Stored
Value - A non-reactive,
Copyhandle for any value. - Submission
- An action that has been submitted by dispatching it to a
MultiAction. - Suppress
Resource Load - 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. - Suspense
Props - Props for the
Suspensecomponent. - Sync
Storage - A form of
Storagethat stores the type as itself, with no wrapper. - Text
Prop - Describes a value that is either a static or a reactive string, i.e.,
a
String, a&str, aSignalor a reactiveFn() -> String. - Timeout
Handle - Handle that is generated by set_timeout_with_handle and can be used to clear the timeout.
- Transition
Props - Props for the
Transitioncomponent. - Trigger
- A trigger is a data-less signal with the sole purpose of notifying other reactive code of a change.
- Typed
Children - A typed equivalent to
Children, which takes a generic but preserves type information to allow the compiler to optimize the view more effectively. - Typed
Children Fn - A typed equivalent to
ChildrenFn, which takes a generic but preserves type information to allow the compiler to optimize the view more effectively. - Typed
Children Mut - A typed equivalent to
ChildrenFnMut, which takes a generic but preserves type information to allow the compiler to optimize the view more effectively. - Unmount
Handle - On drop, this will clean up the reactive
Ownerand unmount the view created bymount_to. - Unsuspend
- A wrapper that prevents
Suspensefrom waiting for any resource reads that happen insideUnsuspend. - Unsync
Callback - A callback type that is not required to be
Send + Sync. - View
- A wrapper for any kind of view.
- ViewFn
- New-type wrapper for a function that returns a view with
FromandDefaulttraits implemented to enable optional props in for example<Show>and<Suspense>. - View
FnOnce - New-type wrapper for a function, which will only be called once and returns a view with
FromandDefaulttraits implemented to enable optional props in for example<Show>and<Suspense>. - View
Template - A view wrapper that uses a
<template>node to optimize DOM node creation. - Window
Listener Handle - A handle that can be called to remove a global event listener.
- Write
Signal - An arena-allocated setter for a reactive signal.
Enums§
- Env
- An enum that can be used to define the environment Leptos is running in.
Setting this to the
PRODvariant will not include the WebSocket code forcargo-leptoswatch mode. Defaults toDEV. - From
Form Data Error - Errors that can arise when converting from an HTML event or form into a Rust data type.
- From
Utf8 Error - Error returned from
Oco::try_fromfor unsuccessful conversion fromOco<'_, [u8]>toOco<'_, str>. - Maybe
Signal Deprecated - A wrapper for a value that is either
TorSignal<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.
- ReloadWS
Protocol - An enum that can be used to define the websocket protocol Leptos uses for hotreloading
Defaults to
ws. - Server
FnError - 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 implementsFromServerFnError. - Server
FnError Err - Type for errors that can occur when using server functions. If you need to return a custom error type from a server function, implement
FromServerFnErrorfor your custom error type. - Signal
Read Guard - The content of a
Signalwrapper read guard, variable depending on the signal type. - Signal
Types - Possibilities for the inner type of a
Signal.
Traits§
- AddAny
Attr - 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.
- Aria
Attributes - Applies ARIA attributes to an HTML element.
- Bind
Attribute - 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.
- Class
Attribute - Adds an attribute that modifies the
class. - Collect
View - Collects some iterator of views into a list, so they can be rendered.
- Component
- Component
Constructor - Custom
Attribute - Adds a custom attribute to an element.
- Defined
At - Describes where the signal was defined. This is used for diagnostic warnings and is purely a debug-mode tool.
- Directive
Attribute - 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.
- Effect
Function - Trait to enable effect functions that have zero or one parameter
- Element
Child - Adds a child to the element.
- Element
Ext - 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.
- Error
Hook - Implements behavior that allows for global or scoped error handling.
- Flatten
Option RefOption - Helper trait to implement flatten() on
Option<&Option<T>>. - From
Encoded Str - Decodes data from a string.
- From
Form Data - Tries to deserialize a type from form data. This can be used for client-side validation during form submission.
- From
Local - Converts some value into a locally-stored type, using
LocalStorage. - From
Server FnError - A trait for types that can be returned from a server function.
- From
Stream - 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
Gettrait that provides a signposted “always-non-reactive” API. E.g. forStoredValue. - Global
Attributes - Global attributes can be added to any HTML element.
- Global
OnAttributes - Provides methods for HTML event listener attributes.
- Inner
Html Attribute - Sets the inner HTML of an element.
- IntoAny
- Allows converting some view into
AnyView. - Into
AnyAttribute - Converts an
AttributeintoAnyAttribute. - Into
Attribute Value - Declares that this type can be converted into some other type, which is a valid attribute value.
- Into
Encoded String - Encodes data into a string.
- Into
Inner - Turns a signal back into a raw value.
- Into
Maybe Erased - A more general version of
IntoAnythat allows intoAnyView, but also erasing other types that don’t implementRenderHtmllike routing. - Into
Option Getter - Conversion trait for creating an
OptionGetterfrom a closure or a signal. - Into
Render - Declares that this type can be converted into some other type, which can be rendered.
- Into
Signal Setter - Helper trait for converting
Fn(T)intoSignalSetter<T>. - Into
View - 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.
- Node
RefAttribute - Adds the
node_refattribute to an element. - Notify
- Notifies subscribers of a change in this signal.
- OnAttribute
- Adds an event listener to an element definition.
- OnTarget
Attribute - Adds an event listener with a typed target to an element definition.
- Option
Text Prop Ext - Extension trait for
Option<TextProp> - Prop
Attribute - 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.
- Read
Optional - An alternative
Readtrait that works withOption<Readable>types. - Read
Untracked - Give read-only access to a signal’s value by reference through a guard type, without tracking the value reactively.
- Read
Untracked Optional - An alternative
ReadUntrackedtrait that works withOption<Readable>types. - Read
Value - A variation of the
Readtrait that provides a signposted “always-non-reactive” API. E.g. forStoredValue. - Render
- The
Rendertrait allows rendering something as part of the user interface. - Render
Html - The
RenderHtmltrait 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
Settrait that provides a signposted “always-non-reactive” API. E.g. forStoredValue. - Storage
- A way of storing an
ArenaItem, either as itself or with a wrapper to make it threadsafe. - Storage
Access - A trait for borrowing and taking data.
- Style
Attribute - 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.
- Untrackable
Guard - 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.
- Update
Untracked - Updates the value of a signal by applying a function that updates it in place, without notifying subscribers.
- Update
Value - A variation of the
Updatetrait that provides a signposted “always-non-reactive” API. E.g. forStoredValue. - 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.
- With
Optional - An alternative
Withtrait that works withOption<Withable>types. - With
Untracked - Give read-only access to a signal’s value by reference inside a closure, without tracking the value reactively.
- With
Untracked Optional - An alternative
WithUntrackedtrait that works withOption<Withable>types. - With
Value - A variation of the
Withtrait that provides a signposted “always-non-reactive” API. E.g. forStoredValue. - 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.
- Write
Value - A variation of the
Writetrait that provides a signposted “always-non-reactive” API. E.g. forStoredValue.
Functions§
- Action
Form - Automatically turns a server Action into an HTML
formprogressively enhanced to use client-side routing. - Animated
Show - A component that will show its children when the
whencondition istrue. Additionally, you need to specify ahide_delay. If thewhencondition changes tofalse, the unmounting of the children will be delayed by the specified Duration. If you provide the optionalshow_classandhide_class, you can create very easy mount / unmount animations. - Auto
Reload - Inserts auto-reloading code used in
cargo-leptos. - Await
- Allows you to inline the data loading for an
asyncblock 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 aSuspensewith nofallback. - Error
Boundary - When you render a
Result<_, _>in your view, in theErrcase 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
keyfunction given. - ForEnumerate
- Iterates over children and displays them, keyed by the
keyfunction given. - Hydration
Scripts - Inserts hydration scripts that add interactivity to your server-rendered HTML.
- Multi
Action Form - Automatically turns a server MultiAction into an HTML
formprogressively enhanced to use client-side routing. - Show
- Required Props
- ShowLet
- Like
<Show>but forOption. This is a shortcut for - Suspense
- If any
Resourceis read in thechildrenof this component, it will show thefallbackwhile they are loading. Once all are resolved, it will render thechildren. - Transition
- If any
Resourceis read in thechildrenof this component, it will show thefallbackwhile they are loading. Once all are resolved, it will render thechildren. - arc_
signal - Creates a reference-counted signal.
- batch
- Defers any ImmediateEffects from running until the end of the function.
- 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
delayafter it is called. If it is called again during that period, it will waitdelaybefore 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.targetfrom any event. - event_
target_ checked - Helper function to extract
event.target.checkedfrom an event. - event_
target_ value - Helper function to extract
event.target.valuefrom an event. - expect_
context - Extracts a context value of type
Tfrom 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.
- in_
effect_ scope - Returns whether the current thread is currently running an effect.
- is_
browser - Returns
trueif the current environment is a browser. - is_
server - Returns
trueif the current environment is a server. - location
- Returns the current
window.location. - location_
hash - Current
window.location.hashwithout 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
Tto the current reactiveOwnerand all of its descendants. This can be accessed usinguse_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
throwis 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
Tfrom the reactive system, and takes ownership, removing it from the context system. - throw
- Invokes the error hook set by
set_error_hookwith the given error. - untrack
- Suspends reactive tracking while running the given function.
- update_
context - Update a context value of type
Tin the reactive system. - use_
context - Extracts a context value of type
Tfrom the reactive system. - 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 genericEvent, returning a cancelable handle. - with_
context - Access a reference to a context value of type
Tin the reactive system.
Type Aliases§
- Async
Derived Guard - A read guard that holds access to an async derived resource.
- Children
- The most common type for the
childrenproperty on components, which can only be called once. - Children
Fn - A type for the
childrenproperty on components that can be called more than once. - Children
FnMut - A type for the
childrenproperty on components that can be called more than once, but may mutate the children. - Children
Fragment - A type for the
childrenproperty on components that can be called only once, and provides a collection of all the children passed to this component. - Children
Fragment Fn - A type for the
childrenproperty on components that can be called more than once, and provides a collection of all the children passed to this component. - Children
Fragment Mut - A type for the
childrenproperty 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.
Attribute Macros§
- 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
islandsfeature of Leptos. Apart from the macro name, the API is the same as thecomponentmacro. - 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
ssrfeature on this crate is enabled. - slot
- Annotates a struct so that it can be used with your Component as a
slot.
Derive Macros§
- Params
- Derives a trait that parses a map of string keys and values into a typed data structure, e.g., for route params.