Expand description
Web support for Sycamore.
Re-export of the [sycamore_web
] crate.
Modules§
- bind
- Definition for bind-able attributes/properties.
- events
- Definition for all the events that can be listened to.
- js_sys
- Bindings to JavaScript’s standard, built-in objects, including their methods and properties.
- tags
- Definition of all the HTML and SVG elements.
Macros§
- cfg_
not_ ssr_ item macro_rules!
equivalent ofcfg_not_ssr
. This is to get around the limitation of not being able to put proc-macros onmod
items.- cfg_
ssr_ item macro_rules!
equivalent ofcfg_ssr
. This is to get around the limitation of not being able to put proc-macros onmod
items.- console_
dbg - Debug the value of a variable to the JavaScript console if on wasm32. Otherwise logs it to stdout.
- console_
error - Prints an error message to the JavaScript console if on wasm32. Otherwise logs it to stderr.
- console_
log - Log a message to the JavaScript console if on wasm32. Otherwise logs it to stdout.
- console_
warn - Log a warning to the JavaScript console if on wasm32. Otherwise logs it to stderr.
- is_
not_ ssr - A macro that expands to whether we are in DOM mode or not.
- is_ssr
- A macro that expands to whether we are in SSR mode or not.
Structs§
- Attributes
- A special prop type that can be used to spread attributes onto an element.
- Custom
Element - A struct representing a custom element. This can be created by calling
custom_element
. - Hydration
Key - Indexed
Props - Props for
Keyed
. - Keyed
Props - Props for
Keyed
. - NoHydrate_
Props - Props for
NoHydrate
. - NoSsr_
Props - Props for
NoSsr
. - NodeRef
- A reference to a
web_sys::Node
. This allows imperative access to the node. - Portal_
Props - Props for
Portal
. - Resource
- Represents a asynchronous resource.
- Show
Props - Props for
Show
. - Suspense
Props - Props for
Suspense
andTransition
. - View
- Represents a view tree.
Enums§
Traits§
- AsHtml
Node - A trait for unwrapping a type into an
HtmlNode
. - Attribute
Value - A trait that represents an attribute that can be set. This is not “attribute” in the HTML spec sense. It can also represent JS properties (and possibly more …) that can be set on an HTML element.
- Global
Attributes - Attributes that are available on all elements.
- Global
Props - Props that are available on all elements.
- Html
Global Attributes - A trait that is implemented for all elements and which provides all the global HTML attributes.
- SetAttribute
- Implemented for all types that can accept attributes (
AttributeValue
). - SvgGlobal
Attributes - A trait that is implemented for all SVG elements and which provides all the global SVG attributes.
- View
Html Node - A trait that should be implemented for anything that represents an HTML node.
- View
Node - A trait that should be implemented for anything that represents a node in the view tree (UI tree).
Functions§
- Hydration
Script - Component that creates a script element for bootstrapping hydration. Should be rendered into
the
<head>
of the document. - Indexed
- Non keyed iteration (or keyed by index).
- Keyed
- Keyed iteration.
- NoHydrate
- Components that do not need, or should not be hydrated on the client side.
- NoSsr
- Component that is only renders its children on the client side.
- Portal
- A portal into a different part of the DOM. Only renders in client side rendering (CSR) mode. Does nothing in SSR mode.
- Show
- An utility component that only renders its children when a condition is satisfied.
- Suspense
Suspense
lets you wait forasync
tasks to complete before rendering the UI. This is useful for asynchronous data-fetching or other asynchronous tasks.- Transition
Transition
is likeSuspense
except that it keeps the previous content visible until the new content is ready.- Wrap
Async - Convert an async component to a regular sync component. Also wraps the async component inside a suspense scope so that content is properly suspended.
- create_
client_ effect - Create a new effect, but only if we are not in SSR mode.
- create_
client_ resource - Create a resrouce that will only be resolved on the client side.
- create_
node_ ref - Create a new
NodeRef
. - custom_
element - Create a new custom element with
tag
. - document
- Utility function for accessing the global
web_sys::Document
object. - generate_
hydration_ script - Generate a script element for bootstrapping hydration.
- hydrate
- Render a
View
under aparent
node by reusing existing nodes (client side hydration). - hydrate_
in_ scope - Render a
View
under aparent
node, in a way that can be cleaned up. - hydrate_
to - Render a
View
under aparent
node by reusing existing nodes (client side hydration). - is_
hydrating - Returns whether we are currently hydrating or not.
- on_
mount - Queue up a callback to be executed when the component is mounted.
- queue_
microtask - Alias for
queueMicrotask
. - render
- Render a
View
into the DOM. Alias forrender_to
withparent
being the<body>
tag. - render_
in_ scope - Render a
View
under aparent
node, in a way that can be cleaned up. - render_
to - Render a
View
under aparent
node. For rendering under the<body>
tag, userender
instead. - render_
to_ string - Render a
View
into a staticString
. Useful for rendering to a string on the server side. - render_
to_ string_ await_ suspense - Renders a
View
into a staticString
while awaiting for all suspense boundaries to resolve. Useful for rendering to a string on the server side. - render_
to_ string_ in_ scope - Render a
View
into a staticString
in the current reactive scope. - render_
to_ string_ stream - Renders a
View
to a stream. - use_
stable_ counter - Get the next counter value. This is stable across client and server side.
- use_
suspense_ key - Get the next suspense key.
- window
- Utility function for accessing the global
web_sys::Window
object.
Type Aliases§
- Bool
Attribute - Type alias respresenting a possibly dynamic boolean value.
- Children
- A type alias for
Children
automatically selecting the correct node type. - Html
Node - A type alias for the rendering backend.
- String
Attribute - Type alias representing a possibly dynamic string value.