Direction Provider
Wraps your app to provide global reading direction.
Features
- Enables all primitives to inherit global reading direction.
Installation
Install the component from your command line.
cargo add radix-leptos-direction
Anatomy
Import the component.
use leptos::*;
use radix_leptos_direction::*;
#[component]
fn Anatomy() -> impl IntoView {
view! {
<DirectionProvider />
}
}
API Reference
Root
When creating localized apps that require right-to-left (RTL) reading direction, you need to wrap your application with the DirectionProvider
component to ensure all of the primitives adjust their behavior based on the dir
prop.
Prop | Type | Default |
---|---|---|
dir | MaybeSignal<Direction> | - |
Example
Use the direction provider.
use leptos::*;
use radix_leptos_direction::*;
#[component]
fn Example() -> impl IntoView {
view! {
<DirectionProvider dir=Direction::Rtl>
/* your app */
</DirectionProvider>
}
}