Documentation Index
Fetch the complete documentation index at: https://mintlify.com/flet-dev/flet/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Base class for all visual controls in Flet. Provides common properties and behavior for layout, visibility, and user interaction. Source:flet.controls.control:12
Class Signature
Properties
Layout Properties
Specifies whether/how this control should expand to fill available space in its parent layout.Source:
control.py:20Values:None: Control takes minimum required spaceTrueor1: Control expands to fill available spaceint > 1: Control expands proportionally (flex factor)
Column, Row, View, or Page.Raises: ValueError if not None, bool, or intAllows the control to expand along the main axis if space is available, but does not require it to fill all available space.Source:
control.py:37Effect: Only works when:expandis notNone- Direct parent is
Column,Row,View, orPage
If parent is a
ResponsiveRow, this determines how many virtual columns (out of 12) this control spans.Source: control.py:55Can be:- A number: Applies to all breakpoints
- A dictionary: Different values per breakpoint
| Breakpoint | Dimension |
|---|---|
| xs | Less than 576px |
| sm | 576px and up |
| md | 768px and up |
| lg | 992px and up |
| xl | 1200px and up |
| xxl | 1400px and up |
Visual Properties
Defines the transparency of the control.Source:
control.py:78Range: 0.0 (fully transparent) to 1.0 (fully opaque)Raises: ValueError if not between 0.0 and 1.0Controls whether the control is rendered on the page.Source:
control.py:99When False:- Control is not rendered
- Cannot be focused or selected
- Does not emit events
- Children (if any) are also hidden
Controls whether the control and its children are enabled.Source:
control.py:108Propagation: Value is recursively applied to all children controls.Whether the text direction of the control should be right-to-left (RTL).Source:
control.py:134Interactive Features
The tooltip to show when this control is hovered over.Source:
control.py:89Can be:- A string: Simple tooltip text
- A
Tooltipobject: Advanced configuration
A badge to show on top of this control.Source:
control.py:94Can be:- A string or number: Simple badge label
- A
Badgeobject: Advanced configuration
Lifecycle Hooks
Called every time before this control is updated.Source:
control.py:139Warning: Do not call update() inside this method to avoid infinite loops.Inherited from BaseControl
Control inherits all properties and methods from BaseControl, including:Properties
data- Arbitrary data of any typekey- Optional key for control identificationref- Reference to this controlparent- Direct ancestor of this control (read-only)page- Page to which this control belongs (read-only)
Methods
update()- Request a UI update for this controlinit()- Called after control instance initializationbuild()- Called once during control initializationdid_mount()- Called after control is mounted into page treewill_unmount()- Called before control is removed from page tree
Usage Examples
Expanding Controls
Responsive Grid Layout
Visibility and Disabled States
Opacity Animation
Using Data Property
Validation
Thebefore_update() method validates properties before each update:
opacitymust be between 0.0 and 1.0 (inclusive)expandmust beNone,bool, orint
ValueError.
See Also
- BaseControl - Base class for all controls
- Page - Top-level page container
- [Container(/api/material/container) - General-purpose container control
- [Column and Row(/api/layout/column) - Layout controls