Component Stylesheets¶
Most shipped views keep their look in a stylesheet, <Name>_Stylesheet.tdl, beside the view itself, <Name>_View.tdl (a few, such as the tab and chip groups, have only their params). Each page here shows one stylesheet, how its rules reach the view, and what each part's rules do.
How they work¶
A stylesheet is a list of rules. A rule names a widget (the view), may narrow it, and gives a Style:
Styles {
Rule {
Widget: Button
Variant: filled
Style { Background: primary, Foreground: on_primary }
}
Rule {
Widget: Button
Variant: filled
State: disabled
Style { Background: "on_surface@12%" }
}
Rule {
Widget: Card
Part: headline
Style { Foreground: on_surface }
}
}
- A rule narrows by the properties the view declares (
Variant,Size,Shape),Classes, a nodeName, aPart(a named node inside the view; a name the view does not have is an error that suggests the nearest) and aState. - A value in
<| |>is an expression over the view's parameters, worked out where the view is used. - The most specific rule wins; a node's own
Stylebeats every rule for the fields it sets. - A stylesheet is read only when the application uses its widget: the widgets in the views you open, and in the views those call. The shipped rules are the lowest layer, a
<Name>_Stylesheet.tdlof yours (next to your views, or inStyles/) goes over them, and your app's stylesheet goes over that. A view of the same name that you wrote replaces the shipped one and its look. - Hot reload watches the stylesheets a view uses.
See The View Language for the rule syntax and Themes for colours, type and shape.
Actions¶
- Buttons:
Button - Icon buttons:
IconButton - Floating action buttons:
Fab
Communication¶
Containment¶
- Cards:
Card - Dialogs:
Dialog - File dialog:
FileDialog - Dividers:
Divider - Lists:
ListItem - Side sheets:
SideSheet,SideSheetModal,SideSheetPanel - Accordions:
Accordion - Trees:
TreeNode
Navigation¶
- Navigation rail:
NavigationRail,NavigationRailItem - Navigation drawer:
NavigationDrawer,NavigationDrawerItem,NavigationDrawerModal,NavigationDrawerPanel,NavigationDrawerScreens - Top app bar:
TopAppBar - Menus:
Menu,MenuItem - Search:
SearchBar,SearchView - Toolbars:
Toolbar - Links:
Link
Selection and input¶
- Chips:
Chip - Text fields:
TextField - Spin box:
SpinBoxField - Date picker:
DatePicker,DatePickerDay - Time picker:
TimePicker,PeriodSelector - Colour picker:
ColourPicker - Icon picker:
IconPicker,IconPickerPanel - Font list:
FontList,FontListPanel - Key chord field:
KeyChordField - List editor:
ListEditor - Token button:
TokenButton - Time input:
TimeInput
Content¶
- Video:
VideoPlayer - Carousel:
Carousel - Pagination:
Pagination
Beyond MD3¶
- Status bar:
StatusBar