5

Component behavior - Material Design

 3 years ago
source link: https://material.io/design/layout/component-behavior.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Component adaptation describes changes in visual presentation (padding, size, layout, or alignment), or switching out one component for another that is  better suited to the device size and use case.

Visual presentation

Visual presentation is the most common method of adaptation. This type of adaptation affects the scale and placement...

Visual presentation is the most common method of adaptation. This type of adaptation affects the scale and placement of content and objects on screen, as well as their relationships to each other. For example, a text list on a mobile device can adjust margins, vertical spacing, or density to better fit larger screens like tablets.

Size constraints

Material Components have minimum and maximum values for container dimensions, margins, and padding. For size constraints of each component, visit the Components section.

For example, snackbars have a maximum width of 600dp for large screens. These minimum and maximum values allow for continuous change to the component’s visual presentation as a layout expands from mobile to large screens.

When scaling a layout, components can have fixed or responsive widths within the range of size constraints.

Elements with fixed widths remain the same width regardless of a screen’s size.

Diagram of a mobile UI scaling as a button stays the same size
The button component remains fixed in position and size along the right margin.

Elements with responsive widths expand and contract as a screen size changes.

Diagram of a mobile UI scaling as a button scales
The button scales in response to the two columns on the right side.
Diagram of a mobile UI scaling down as a button scales, becoming too small to accommodate its label
Don'tDon’t use a container on responsive components if the screen is too narrow to display elements and padding at smaller widths.
Diagram of a mobile UI scaling up as the button scales to remain full-width
CautionUse caution when enlarging a responsive component across several columns in a wide screen. Certain components such as buttons can become overly emphasized at larger screen widths.

Internal Composition

When scaling a component, define the position and alignment of its internal elements in relationship to the container.

For example, the icon and text label within an icon button remain anchored to each other and remain centered while the button expands horizontally.

Two buttons of different widths, with the internal elements centered in both
A button's internal elements maintain a consistent relationship as the component scales

For more complex components, like app bars, internal elements can be grouped and anchored to multiple points within the container.

For example, a menu icon and logo can be grouped and anchored to the leading edge, while a search bar is anchored to the center, and action icons  are anchored to the trailing edge.

Diagram of an app bar in Fortnightly, labeling elements anchored to each edge
1. Logo and menu icon anchored to the leading edge of Fortnightly's app bar 2. Account picker anchored to the trailing edge of Fortnightly's app bar

A component’s internal composition should accommodate the ergonomic needs of the device on which it’s displayed. For example, a horizontally-oriented card on a mobile device can shift to a more square-shaped card on larger screens. This adaptation gives more prominence to imagery and allows for larger type styles to enhance readability.

Two cards shown in different orientations
Cards can change orientation on larger screens.


Component swapping

As a layout scales across screen sizes, functionally equivalent components can be interchanged to make large-scale changes to the ergonomic and functional qualities of an interface.

As a layout changes across screen sizes, components with similar functions can also be exchanged. This makes it possible to adjust a layout for large-scale changes to the ergonomic and functional qualities of an interface.

For example, a bottom navigation bar can swap with a navigation rail on tablets, and a navigation drawer on larger screens.

Components can switch types as well. For example, a full-screen dialog on mobile can  be exchanged with a simple dialog on larger screens. This component change maintains the function of the dialog, while also making use of screen space in a way that preserves a user’s context by revealing underlying content.

Mobile UI showing a full-screen dialog and tablet UI showing a simple dialog with the same content
A full screen dialog can adapt to a simple dialog on larger screens.

Some functionally-equivalent component groups are defined below.

Component typeMobile optionTablet optionLaptop optionNavigationBottom navigationNavigation railNavigation drawerNavigationModal navigation drawerModal navigation drawerPermanent navigation drawerCommunicationFull-screen dialogSimple dialogSimple dialogActionBottom sheetMenuMenu

Use caution when swapping components by ensuring that the interchangeable components are functionally equivalent. Do not, for example, swap a button for a chip. Use caution when changing between list items and cards. The component swap should always serve a functional and ergonomic purpose for the user.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK