tree: 373744984841f889563959b7402c0028d0016f78 [path history] [tgz]
  1. assets/
  2. README.md
  3. shape-category-mapping.md
  4. shape-content-margins.md
  5. typical-use-customizing-a-scheme.md
components/schemes/Shape/docs/README.md

Shape scheme

The Material Design shape system can be used to create a shape theme that reflects your brand or style.

Related Documentation


Overview

An implementation of the Material Design shape scheme is provided in the MDCShapeScheme class. By default, an instance of this class is configured with the Material defaults. The following image shows an MDCButton themed with the default shape scheme values (bottom) and an MDCButton themed with custom shape scheme values (top).

Currently, 5 components support being themed with a shape scheme using a shape themer extension, namely Cards, Buttons, FABs, Chips, and Bottom Sheet. You can learn more about which extensions are available for a given component by reading the component documentation.

Shape Values

A shape scheme consists of the following shape values:

Shape CategoryUse
smallComponentShapeThe shape defining small sized components.
mediumComponentShapeThe shape defining medium sized components.
largeComponentShapeThe shape defining large sized components.

Each of the shape categories are of the class MDCShapeCategory.

An MDCShapeCategory holds properties that define a shape value. It consists of 4 corners of type MDCCornerTreatment that represent each corner of the shape. It also has a convenience initializer to set all the 4 corners at once to the same value, creating a symmetrical shape.

Lastly, an MDCCornerTreatment can be set by using any of the convenience initializers in MDCCornerTreatment+CornerTypeInitializer.h.

Shape to Component Mapping

Installation

Installation with CocoaPods

Add the following to your Podfile:

pod 'MaterialComponents/schemes/Shape'

Then, run the following command:

pod install

Importing

To import the component:

Swift

import MaterialComponents.MaterialShapeScheme

Objective-C

#import "MaterialShapeScheme.h"

Usage

Component content awareness when using custom shapes