Chip

Chips are compact elements that represent an input, attribute, or action.

https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/chips.png

Usage

MDChip:
    label: 'Coffee'
    color: .4470588235118, .1960787254902, 0, 1
    icon: 'coffee'
    callback: app.callback_for_menu_items

The user function takes two arguments - the object and the text of the chip:

def callback_for_menu_items(self, instance, value):
    print(instance, value)
https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/ordinary-chip.png

Use custom icon

MDChip:
    label: 'Kivy'
    icon: 'data/logo/kivy-icon-256.png'
https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/chip-custom-icon.png

Use without icon

MDChip:
    label: 'Without icon'
    icon: ''
https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/chip-without-icon.png

Chips with check

MDChip:
    label: 'Check with icon'
    icon: 'city'
    check: True
https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/chip-check-icon.gif

Choose chip

MDChooseChip:

    MDChip:
        label: 'Earth'
        icon: 'earth'
        selected_chip_color: .21176470535294, .098039627451, 1, 1

    MDChip:
        label: 'Face'
        icon: 'face'
        selected_chip_color: .21176470535294, .098039627451, 1, 1

    MDChip:
        label: 'Facebook'
        icon: 'facebook'
        selected_chip_color: .21176470535294, .098039627451, 1, 1
https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/chip-shoose-icon.gif

API - kivymd.uix.chip

class kivymd.uix.chip.MDChip(**kwargs)

Bases: kivy.uix.boxlayout.BoxLayout, kivymd.theming.ThemableBehavior

label

Chip text.

label is an StringProperty and defaults to ‘’.

icon

Chip icon.

icon is an StringProperty and defaults to ‘checkbox-blank-circle’.

color

Chip color in rgba format.

color is an ListProperty and defaults to [].

check

If True, a checkmark is added to the left when touch to the chip.

check is an BooleanProperty and defaults to False.

callback

Custom method.

callback is an ObjectProperty and defaults to None.

radius

Corner radius values.

radius is an NumericProperty and defaults to ‘12dp’.

selected_chip_color

The color of the chip that is currently selected in rgba format.

selected_chip_color is an ListProperty and defaults to [].

on_icon(self, instance, value)
on_touch_down(self, touch)
class kivymd.uix.chip.MDChooseChip

Bases: kivy.uix.stacklayout.StackLayout

add_widget(self, widget, index=0, canvas=None)