Mohammad Cazi 2835de1ac5
[Chips] Auto Generated README update. (#3621)
* chips readme components added and autogenerated a new chip readme.

* readme updates.

* change component name to chips.

* short description was missing.

https://github.com/material-components/material-components-ios/pull/3621
2018-05-01 17:08:40 -04:00

1.5 KiB

Ink ripple animation

Chips display animated ink splashes when the user presses the chip. Keep in mind this will appear on top of your 'highlighted' backgroundColor.

Stateful properties

Like UIButton, Material Chips have many state-dependant properties. Set your background color, title color, border style, and elevation for each of their states. If you don't set a value for a specific state it will fall back to whatever value has been provided for the Normal state. Don't forget that you'll also need to set values for the combined states, such as Highlighted | Selected.

Selected Image View

In order to make it as clear as possible a chip has been selected, you can optionally set the image of the selectedImageView. This image will only appear when the chip is selected. If you have a image set on the standard imageView, then the selectedImageView will appear on top. Otherwise you'll need to resize the chip to show the selected image. See the Filter chip example to see this in action.

Padding

There are 4 padding properties which control how a chip is laid out. One for each of the chip's subviews (imageView and selectedImageView share one padding property), and one which wraps all the others (contentPadding). This is useful so that you can set each of the padding properties to ensure your chips look correct whether or not they have an image and/or accessory view. The chip uses these property to determine intrinsicContentSize and sizeThatFits.