Fusuma

Reference

Components

120 views, each with its signature, its methods and an example that the test suite runs. 80 of them run live in the page, on the gallery page that uses them. The rest are drawn by the toolkit from the example.

Basics 27

Text, buttons, the fields and the containers that scroll.

text drawn by FusumatextliveText in the body size.text_fmt drawn by Fusumatext_fmtliveText from format_args!, in the body size.button drawn by FusumabuttonliveA button with text, secondary until Button::primary.checkbox drawn by FusumacheckboxliveA checkbox with text, ticked or not.progress drawn by FusumaprogressliveA progress bar.spacer drawn by FusumaspacerliveA spring.toast drawn by FusumatoastliveA toast, hidden until a task shows one.host_surface drawn by Fusumahost_surfaceA surface the host knows as id, filling its parent until size says otherwise.radio drawn by FusumaradioliveA radio button.switch drawn by FusumaswitchliveA switch with text, on or off.slider drawn by FusumasliderliveA slider.text_field drawn by Fusumatext_fieldliveA text field holding value.item drawn by FusumaitemliveA list row.tab drawn by FusumatabliveA tab of a tab bar.paragraph drawn by FusumaparagraphliveA paragraph.icon drawn by FusumaiconliveAn icon, as an outline (see IconView::filled).scroll drawn by FusumascrollliveA column that scrolls when its content is taller than it is (give it a height).scroll_x drawn by Fusumascroll_xA row that scrolls sideways when its content is wider than it is (give it a width): a strip of cards, a wide table.tab_bar drawn by Fusumatab_barliveA row that gives each of its tabs an equal share.dialog drawn by FusumadialogA modal dialog, open or not.bottom_sheet drawn by Fusumabottom_sheetA bottom sheet, open or not: a modal panel on the bottom edge, as wide as the screen and as tall as its content.hover_card drawn by Fusumahover_cardA hover card: a panel that opens by itself under the node called anchor when the pointer has rested on it for half a second, and closes when it leaves the anchor and the card.menu drawn by FusumamenuliveA menu that hangs from the node called anchor while it is open.gestures drawn by Fusumagesturesliveview, listening for gestures: add .on_long_press(..) and .on_swipe(..).variantA button that is primary or not, by a condition (a small convenience for a toggle that looks different when on).draggable drawn by Fusumadraggableview, which can be picked up when a press on it travels: on_start is what picking it up sends (the app remembers what is being carried), and Dnd::on_cancel what ending the drag over nothing sends.drop_target drawn by Fusumadrop_targetview, which takes what is dropped on it: on_drop is what a drop sends (the app moves what it was carrying, which it remembered when the drag started).

Layout 16

Columns, rows, grids, cards and the words that style them.

column drawn by FusumacolumnliveChildren top to bottom.row drawn by FusumarowliveChildren side by side.wrap drawn by FusumawrapliveChildren side by side that wrap onto the next line when they do not fit the width (give it .width(Length::Fill(1)) or a fixed width; the gap is between children and between lines): a row of chips, tags or buttons on any size of screen.grid drawn by Fusumagridlivecols columns of equal width, each row as tall as its tallest cell (give it .width(Length::Fill(1)) or a fixed width; the gap is between cells and between rows): a launcher, a settings grid, a keypad.grid_tracks drawn by Fusumagrid_tracksA grid whose columns have the widths given (at most eight): Track::fixed, Track::AUTO (as wide as the widest cell) or Track::fill (a share of what is left).grid_areas drawn by Fusumagrid_areasA grid laid out by a template of named areas, "header header / nav main": rows are separated by /, cells by spaces.area drawn by FusumaareaA column that fills the area name of the template template (the same string as the grid_areas it is in): it spans as many columns and rows as the area covers.card drawn by FusumacardliveA column on the raised, rounded card surface.elevated drawn by FusumaelevatedliveChildren on a sheet that sits level above the page: a column on the card surface, rounded, with room inside and room around it for what the theme draws under it (stacked sheets of paper or a blurred shadow, by the theme's ElevationStyle).show drawn by Fusumashowliveview while when is true, nothing (and no room) while it is false.named drawn by Fusumanamedliveview, called id.styled drawn by Fusumastyledview with style on its node: a size, a margin or a place in a grid for a widget that has no setters of its own (a button as wide as its row, a spring of a fixed size, a row of a list that fills).animate drawn by Fusumaanimateview, moved by to on a spring (see fusuma_anim::SpringConfig for the presets).flipping drawn by Fusumaflippingview (a container), with its children carried to their new places on a spring when they move.present drawn by Fusumapresentview while when is true; coming in from offset, and leaving to it, on a spring.class drawn by Fusumaclassview, in style class class (0 is the default look).

Components 38

Alerts, tables, charts, selects, split views and the other ready-made parts.

alert drawn by FusumaalertliveA message in a card with a bar of its tone down the side: a title and a line under it.banner drawn by FusumabannerliveA solid strip of a tone with one line on it (text in black or white, whichever reads).tag drawn by FusumatagliveA short word in a pill of a tone: a status, a count, a label.stat_card drawn by Fusumastat_cardliveA number with its name and, under it, how it changed (a tag in the tone of the change).empty_state drawn by Fusumaempty_stateWhat to show when there is nothing to show: a title and a sentence, centred; put an action under it in the same column.skeleton drawn by FusumaskeletonA grey bar where something will load (a line of text is about height 12).snackbar drawn by FusumasnackbarliveA line of text and the action it offers (undo, retry) in one strip.chip drawn by FusumachipliveA choice that can be switched on and off: a filter, a tag to pick.accordion drawn by FusumaaccordionliveA heading that opens and closes what is under it: the heading is a button (filled while open), the body is kept and hidden when closed, so what is in it keeps its state.segmented drawn by FusumasegmentedliveA segmented control: labels, the chosen index, and the message made from the index that was pressed.breadcrumbs drawn by FusumabreadcrumbsliveBreadcrumbs for parts, sending the index of the part that was pressed.page_windowThe PAGE_SLOTS buttons for page current of total (both counted from 1; out-of-range values are held in range): every page when they fit, else the first, the last, the neighbours of the current one and a gap where pages are left out, the current one never at the edge of a gap.pagination drawn by FusumapaginationlivePagination for page current of total (from 1), sending the page that was pressed (the arrows send the one before and after, and cannot be pressed at the ends).step_stateThe state of step index when the current one is current (counted from 0).steps drawn by FusumastepsliveSteps named labels, the current one marked (earlier ones are done).gauge drawn by FusumagaugeliveA gauge filled to permille thousandths, text in the middle.spinner drawn by FusumaspinnerliveA spinner of the theme's size.kbd drawn by FusumakbdliveA key cap labelled label.dismissible_alert drawn by Fusumadismissible_alertAn alert with a close button: pressing it sends on_dismiss, and the app stops showing the alert (the view for it is left out, or wrapped in show).rating drawn by FusumaratingliveFive stars, the first value of them filled; pressing the n-th sends on_rate(n) (pressing the one that is already the value is the app's to treat as clearing it).page_dots drawn by Fusumapage_dotsliveDots for count pages with current marked.carousel drawn by FusumacarouselliveOne page of total at a time, with arrows and dots under it: content is the current page's view, on_page what an arrow sends (the page it goes to, held to the ends).timeline drawn by FusumatimelineliveA timeline of (title, caption) items, the first current + 1 marked as reached.table drawn by FusumatableliveA table with headers for the columns and rows of cells (a row with fewer cells than headers leaves the rest empty; a longer one is cut).splitter drawn by FusumasplitterA splitter at permille thousandths, sending what on_change makes of the new position.split_view drawn by Fusumasplit_viewliveTwo panes side by side with a draggable bar between them: permille of the width goes to left (held between 50 and 950, so neither pane can be dragged shut).split_view_vertical drawn by Fusumasplit_view_verticalTwo panes one above the other, the same way (permille of the height goes to top).image drawn by FusumaimageliveAn image of width x height pixels.segments drawn by FusumasegmentsliveA segmented bar lit to permille thousandths, as many ticks as fit.sprite drawn by FusumaspritelivePixel art, one string per row.tile drawn by FusumatileliveA square card for one thing among many (a session, a device, a room): its picture, its name and a line of state under it, centred, width wide (the room the theme keeps for its elevation is in it).select drawn by FusumaselectliveA select over options with selected chosen, the menu open or not.combobox drawn by FusumacomboboxA text field with a list of suggestions under it: the app filters its options by what was typed and gives the first SUGGESTIONS of them; pressing one sends on_pick(index) (the app puts it in the field and clears the list).tree_item drawn by Fusumatree_itemliveOne row of a tree: indented by depth, a triangle that opens and closes it when it has children (expanded is Some), and the label as a choice.scale_samplesvalues scaled to 0 to 255 between lo and hi (a value outside is held to the ends; hi <= lo is all zero), the first CHART_MAX of them.line_chart drawn by Fusumaline_chartliveA line through values, scaled between their smallest and largest (change that with Chart::range).area_chart drawn by Fusumaarea_chartliveThe same with the area under the line filled.bar_chart drawn by Fusumabar_chartliveOne bar for each value.

Composite 15

Top bars, form fields, navigation bars, groups of chips and buttons.

top_bar drawn by Fusumatop_barliveThe bar across the top of a screen: a title on the left and, on the right, the actions (icon buttons, a menu).toolbar drawn by FusumatoolbarliveA row of tools in a raised strip: buttons, a divider, a switch.form_field drawn by Fusumaform_fieldliveA label, the control it names, and under it a hint (a rule, an example) or, when error is not empty, the error in the colour of a danger.key_value drawn by Fusumakey_valuelivename on the left and value on the right, one line of a description list (a setting and what it is set to).icon_badge drawn by Fusumaicon_badgeliveThe icon with count on it.fab drawn by FusumafabliveA round button with an icon, in the main action's colour: the one thing a screen is for (compose, add).split_button drawn by Fusumasplit_buttonliveA button and, beside it, a second one that opens the other choices (a menu): the main action and its alternatives.search_bar drawn by Fusumasearch_barliveA search field in a pill with the icon before it (usually Icon::Search) and on_submit for Enter.marksliveThe marks of a list of flags as the bits the groups take (bit i is flags[i]; at most 32).navigation_bar drawn by Fusumanavigation_barliveA bar along the bottom of a screen with one part for each top-level place; current is the place you are in and on_select makes the message from the index that was pressed.navigation_rail drawn by Fusumanavigation_railThe same as a navigation_bar, as a column down the side of a wide screen.toggle_group drawn by Fusumatoggle_groupliveJoined buttons of which any number is on (bold, italic, underline); pressing one sends on_toggle(index) and the app flips it in on.chip_group drawn by Fusumachip_groupliveChips that wrap onto more lines, any number on (filters, tags to pick).button_group drawn by Fusumabutton_groupliveJoined buttons that are each an action, none of them chosen (Cut, Copy, Paste).avatar_group drawn by Fusumaavatar_groupliveAvatars for names (initials are taken from each), size pixels across, at most max of them and a +n for the rest.

Small parts 5

A divider, a badge, an avatar, a stepper.

Date and time 8

A calendar, a time picker and the date arithmetic behind them.

Lists and updates 7

Keyed lists, memoised views and lists of a million rows.

Tiling 1

Panes that split and close.

Your own widgets 1

A widget you write, drawn and sized like the others.

Work 2

Futures that end with a message.