- Add PLAN.md with 40-step checklist across 10 phases - Add CLAUDE.md with project-specific instructions - Set up nix flake with FastHTML/MonsterUI dependencies - Create Python package skeleton (src/animaltrack) - Vendor FastHTML and MonsterUI documentation - Add Docker build configuration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4.1 KiB
Modals API Reference
Example Modal
See Source
See Output
Open Modal
Simple Test Modal
With some somewhat brief content to show that it works!
Close
[code]
def ex_modal():
return Div(
Button("Open Modal",data_uk_toggle="target: #my-modal" ),
Modal(ModalTitle("Simple Test Modal"),
P("With some somewhat brief content to show that it works!", cls=TextPresets.muted_sm),
footer=ModalCloseButton("Close", cls=ButtonT.primary),id='my-modal'))
[/code]
Modal
Source
[code]
Modal(*c, header=None, footer=None, cls=(), dialog_cls=(), header_cls='p-6', body_cls='space-y-6', footer_cls=(), id='', open=False, **kwargs) -> fastcore.xml.FT
[/code]
Creates a modal with the appropriate classes to put the boilerplate in the appropriate places for you
Params
-
cComponents to put in theModalBody(often forms, sign in buttons, images, etc.) -
headerComponents that go in theModalHeader(often aModalTitle) -
footerComponents that go in theModalFooter(often aModalCloseButton) -
clsAdditional classes on the outermostModalContainer -
dialog_clsAdditional classes on theModalDialog -
header_clsAdditional classes on theModalHeader -
body_clsAdditional classes on theModalBody -
footer_clsAdditional classes on theModalFooter -
idid for the outermost container -
openWhether the modal is open (typically used for HTMX controlled modals) -
kwargs
Returns: Fully styled modal FT Component
ModalCloseButton
Source
[code]
ModalCloseButton(*c, cls='absolute top-3 right-3', htmx=False, **kwargs) -> fastcore.xml.FT
[/code]
Creates a button that closes a modal with js
Params
-
cComponents to put in the button (often text and/or an icon) -
clsAdditional classes on the button -
htmxWhether to use HTMX to close the modal (must add hx_get to a route that closes the modal) -
kwargs
Returns: Button(..., cls='uk-modal-close') + hx_target and hx_swap if htmx is True
The remainder of the Modal functions below are used internally by the Modal function for you. You shouldn't need to use them unless you're doing something really special.
ModalTitle
Source
[code]
ModalTitle(*c, cls=(), **kwargs) -> fastcore.xml.FT
[/code]
Creates a modal title
Params
-
cComponents to put in theModalTitle(often text) -
clsAdditional classes on theModalTitle -
kwargs
Returns: H2(..., cls='uk-modal-title')
ModalFooter
Source
[code]
ModalFooter(*c, cls=(), **kwargs) -> fastcore.xml.FT
[/code]
Creates a modal footer
Params
-
cComponents to put in theModalFooter(often buttons) -
clsAdditional classes on theModalFooter -
kwargs
Returns: Div(..., cls='uk-modal-footer')
ModalBody
Source
[code]
ModalBody(*c, cls=(), **kwargs) -> fastcore.xml.FT
[/code]
Creates a modal body
Params
-
cComponents to put in theModalBody(often forms, sign in buttons, images, etc.) -
clsAdditional classes on theModalBody -
kwargs
Returns: Div(..., cls='uk-modal-body')
ModalHeader
Source
[code]
ModalHeader(*c, cls=(), **kwargs) -> fastcore.xml.FT
[/code]
Creates a modal header
Params
-
cComponents to put in theModalHeader -
clsAdditional classes on theModalHeader -
kwargs
Returns: Div(..., cls='uk-modal-header')
ModalDialog
Source
[code]
ModalDialog(*c, cls=(), **kwargs) -> fastcore.xml.FT
[/code]
Creates a modal dialog
Params
-
cComponents to put in theModalDialog(oftenModalBody,ModalHeader, etc) -
clsAdditional classes on theModalDialog -
kwargs
Returns: Div(..., cls='uk-modal-dialog')
ModalContainer
Source
[code]
ModalContainer(*c, cls=(), **kwargs) -> fastcore.xml.FT
[/code]
Creates a modal container that components go in
Params
-
cComponents to put in the modal (oftenModalDialog) -
clsAdditional classes on theModalContainer -
kwargs
Returns: Div(..., cls='uk-modal uk-modal-container')