1515from .domwidget import LabeledWidget
1616from .valuewidget import ValueWidget
1717from .widget_core import CoreWidget
18- from .widget import register
18+ from .widget_style import Style
19+ from .trait_types import InstanceDict
20+ from .widget import register , widget_serialization
1921from traitlets import (Unicode , Bool , Int , Any , Dict , TraitError , CaselessStrEnum ,
2022 Tuple , List , Union , observe , validate )
2123from ipython_genutils .py3compat import unicode_type
@@ -202,6 +204,11 @@ def _validate_value(self, proposal):
202204 except KeyError as k :
203205 raise TraitError ('Invalid selection: %r' % (k .args [0 ],))
204206
207+ @register
208+ class ToggleButtonsStyle (Style , CoreWidget ):
209+ """Button style widget."""
210+ _model_name = Unicode ('ToggleButtonsStyleModel' ).tag (sync = True )
211+ button_width = Unicode (help = "The width of each button." ).tag (sync = True )
205212
206213@register
207214class ToggleButtons (_Selection ):
@@ -214,6 +221,7 @@ class ToggleButtons(_Selection):
214221
215222 tooltips = List (Unicode ()).tag (sync = True )
216223 icons = List (Unicode ()).tag (sync = True )
224+ style = InstanceDict (ToggleButtonsStyle ).tag (sync = True , ** widget_serialization )
217225
218226 button_style = CaselessStrEnum (
219227 values = ['primary' , 'success' , 'info' , 'warning' , 'danger' , '' ],
0 commit comments