
* `pc.color_mode`: a BaseVar that accesses colorMode on the frontend * `pc.color_mode_cond`: a `pc.cond` wrapper that conditionally renders components or props based on the value of `color_mode` * `pc.color_mode_icon`: by default "sun" if light mode, "moon" if dark mode * `pc.color_mode_switch`: a Switch component where is_checked depends on the color_mode and changing the value calls toggle_color_mode * `pc.color_mode_button`: a Button component that calls toggle_color_mode on click The default template has been updated to include a color_mode_button with color_mode_icon for toggling light/dark mode. The inline hover style has also been updated to use color_mode_cond to show a different highlight color based on the color_mode.
48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
"""Convenience functions to define core components."""
|
|
|
|
from .button import Button, ButtonGroup
|
|
from .checkbox import Checkbox, CheckboxGroup
|
|
from .colormodeswitch import (
|
|
ColorModeButton,
|
|
ColorModeIcon,
|
|
ColorModeSwitch,
|
|
color_mode_cond,
|
|
)
|
|
from .copytoclipboard import CopyToClipboard
|
|
from .date_picker import DatePicker
|
|
from .date_time_picker import DateTimePicker
|
|
from .editable import Editable, EditableInput, EditablePreview, EditableTextarea
|
|
from .email import Email
|
|
from .form import Form, FormControl, FormErrorMessage, FormHelperText, FormLabel
|
|
from .iconbutton import IconButton
|
|
from .input import Input, InputGroup, InputLeftAddon, InputRightAddon
|
|
from .multiselect import Option as MultiSelectOption
|
|
from .multiselect import Select as MultiSelect
|
|
from .numberinput import (
|
|
NumberDecrementStepper,
|
|
NumberIncrementStepper,
|
|
NumberInput,
|
|
NumberInputField,
|
|
NumberInputStepper,
|
|
)
|
|
from .password import Password
|
|
from .pininput import PinInput, PinInputField
|
|
from .radio import Radio, RadioGroup
|
|
from .rangeslider import (
|
|
RangeSlider,
|
|
RangeSliderFilledTrack,
|
|
RangeSliderThumb,
|
|
RangeSliderTrack,
|
|
)
|
|
from .select import Option, Select
|
|
from .slider import Slider, SliderFilledTrack, SliderMark, SliderThumb, SliderTrack
|
|
from .switch import Switch
|
|
from .textarea import TextArea
|
|
from .upload import Upload
|
|
|
|
helpers = [
|
|
"color_mode_cond",
|
|
]
|
|
|
|
__all__ = [f for f in dir() if f[0].isupper()] + helpers # type: ignore
|