pub struct Section<C = Schema> { /* private fields */ }Expand description
A titled block holding a form’s fields (schema) or a detail page’s columns
(columns, which detail declares).
use tablo_core::{Field, Schema, Section};
let user = User::fields();
Schema::new((
Section::new("Account")
.description("How the user signs in.")
.aside()
.schema((Field::text(user.name()), Field::text(user.email()))),
Section::new("About")
.collapsed()
.schema(Field::text(user.bio()).multiline(4)),
));A collapsible section renders a <details> element, so it opens and folds without a script.
Its fields render and post while it is folded; a form section holding a field error renders
open, and the browser opens a folded section holding a control it refuses on submit. An
aside section does not collapse.
Implementations§
Source§impl Section<()>
impl Section<()>
Sourcepub fn columns<M>(self, children: impl IntoDetail<M>) -> Section<Detail<M>>
pub fn columns<M>(self, children: impl IntoDetail<M>) -> Section<Detail<M>>
Holds a detail page’s columns and blocks.
Source§impl<C> Section<C>
impl<C> Section<C>
Sourcepub fn class(self, class: impl Into<String>) -> Self
pub fn class(self, class: impl Into<String>) -> Self
Adds an additive class hook on the panel container.
Sourcepub fn description(self, description: impl Into<Text>) -> Self
pub fn description(self, description: impl Into<Text>) -> Self
Shows description under the title.
Sourcepub fn collapsible(self) -> Self
pub fn collapsible(self) -> Self
Lets the title fold the body away; the page opens on it shown.
Source§impl<F> Section<Schema<F>>
impl<F> Section<Schema<F>>
Sourcepub fn visible_when(
self,
watched: &impl Watched<F>,
values: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn visible_when( self, watched: &impl Watched<F>, values: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Shows the block and every field it holds only while watched posts one of
values, as TextField::visible_when shows a
field.
Trait Implementations§
Source§impl<M> IntoDetail<M> for Section<Detail<M>>
impl<M> IntoDetail<M> for Section<Detail<M>>
fn into_detail(self) -> Detail<M>
Source§impl<M> IntoDetail<M> for Section<()>
impl<M> IntoDetail<M> for Section<()>
fn into_detail(self) -> Detail<M>
Source§impl<F> IntoSchema<F> for Section<Schema<F>>
impl<F> IntoSchema<F> for Section<Schema<F>>
fn into_schema(self) -> Schema<F>
Source§impl<F> IntoSchema<F> for Section<()>
impl<F> IntoSchema<F> for Section<()>
fn into_schema(self) -> Schema<F>
Auto Trait Implementations§
impl<C = Schema> !RefUnwindSafe for Section<C>
impl<C = Schema> !UnwindSafe for Section<C>
impl<C> Forget for Section<C>
impl<C> Freeze for Section<C>where
C: Freeze,
impl<C> Send for Section<C>where
C: Send,
impl<C> Sync for Section<C>where
C: Sync,
impl<C> Unpin for Section<C>where
C: Unpin,
impl<C> UnsafeUnpin for Section<C>where
C: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more