Chip¶
See also
Chips are compact elements that represent an input, attribute, or action.
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)
Use custom icon¶
MDChip:
label: 'Kivy'
icon: 'data/logo/kivy-icon-256.png'
Use without icon¶
MDChip:
label: 'Without icon'
icon: ''
Chips with check¶
MDChip:
label: 'Check with icon'
icon: 'city'
check: True
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
Note
API - kivymd.uix.chip
¶
-
class
kivymd.uix.chip.
MDChip
(**kwargs)¶ Bases:
kivy.uix.boxlayout.BoxLayout
,kivymd.theming.ThemableBehavior
-
label
¶ Chip text.
label
is anStringProperty
and defaults to ‘’.
-
icon
¶ Chip icon.
icon
is anStringProperty
and defaults to ‘checkbox-blank-circle’.
-
color
¶ Chip color in
rgba
format.color
is anListProperty
and defaults to [].
-
check
¶ If True, a checkmark is added to the left when touch to the chip.
check
is anBooleanProperty
and defaults to False.
-
callback
¶ Custom method.
callback
is anObjectProperty
and defaults to None.
-
radius
¶ Corner radius values.
radius
is anNumericProperty
and defaults to ‘12dp’.
-
selected_chip_color
¶ The color of the chip that is currently selected in
rgba
format.selected_chip_color
is anListProperty
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)¶
-