UI component constructors for the Dala framework.
Each function returns a node map compatible with Dala.Renderer. These can
be used directly, via the ~dala sigil, or mixed freely — they produce the
same map format.
# Native map literal
%{type: :text, props: %{text: "Hello"}, children: []}
# Component function (keyword list or map)
Dala.UI.text(text: "Hello")
# Sigil (import Dala.Sigil or use Dala.Screen)
~dala(<Text text="Hello" />)All three forms produce identical output and are accepted by Dala.Renderer.
Summary
Functions
Returns an :activity_indicator leaf node. Displays a circular loading spinner.
Returns a :button leaf node. A simple platform button.
Returns a :camera_preview component node. Renders a live camera feed inline.
Returns an :image leaf node. Displays an image from a URL or local asset.
Returns a :list node. A data-driven list (FlatList equivalent).
Returns a :modal container node. Presents content above the enclosing view.
Returns a :native_view node that renders a platform-native component.
Returns a :pressable container node. A pressable wrapper (Pressable equivalent).
Returns a :progress_bar leaf node. Displays a progress bar.
Returns a :refresh_control leaf node. Adds pull-to-refresh to ScrollView.
Returns a :safe_area container node. Applies safe area insets (SafeAreaView equivalent).
Returns a :scroll container node. A scrollable view (ScrollView equivalent).
Returns a :status_bar leaf node. Controls the status bar appearance.
Returns a :switch leaf node. A boolean toggle switch.
Returns a :text leaf node.
Returns a :webview component node. Renders a native web view inline.
Functions
Returns an :activity_indicator leaf node. Displays a circular loading spinner.
Props:
:size—:smallor:large(default::small):color— spinner color (default: theme primary):animating— whether spinner is animating (default: true)
Returns a :button leaf node. A simple platform button.
Props:
:title— button label (required):on_tap—{pid, tag}tuple; fired when button is pressed:color— button color (use:backgroundfor theme-aware coloring):disabled— boolean, disables the button (default: false)
Returns a :camera_preview component node. Renders a live camera feed inline.
Call Dala.Camera.start_preview/2 before mounting this component, and
Dala.Camera.stop_preview/1 when done.
Props:
:facing—:back(default) or:front:width,:height— dimensions in dp/pts; omit to fill parent
Returns an :image leaf node. Displays an image from a URL or local asset.
Props:
:src— URL or local asset name (required):resize_mode—:cover(default),:contain,:stretch,:repeat:width,:height— dimensions in dp/pts; omit to auto-size:corner_radius— optional rounded corners
Returns a :list node. A data-driven list (FlatList equivalent).
Leverages Dala.List for rendering. Requires an :id prop to identify the list
for selection events and custom renderers.
Props:
:data— enumerable of items to render (mapped to:items):id— atom identifier for the list (required for selection events):on_end_reached—{pid, tag}tuple; fired when list reaches end:scroll— boolean, enables scrolling (default: true)
For custom item rendering, register a renderer via Dala.List.put_renderer/3 in mount/3.
Examples
Dala.UI.list(id: :my_list, data: assigns.items)
# With custom renderer in mount/3:
# Dala.List.put_renderer(socket, :my_list, fn item -> ... end)
Returns a :modal container node. Presents content above the enclosing view.
Props:
:visible— boolean, controls whether modal is shown (default: false):on_dismiss—{pid, tag}tuple; fired when user dismisses modal:presentation_style—:full_screen(default) or:page_sheet
Returns a :native_view node that renders a platform-native component.
module must implement the Dala.Component behaviour and be registered
on the native side via dalaNativeViewRegistry. The :id must be unique
per screen — a duplicate raises at render time.
All other props are passed to mount/2 and update/2 on the component.
Example
Dala.UI.native_view(MyApp.ChartComponent, id: :revenue_chart, data: @points)
Returns a :pressable container node. A pressable wrapper (Pressable equivalent).
Props:
:on_press—{pid, tag}tuple; fired when pressed:on_long_press—{pid, tag}tuple; fired on long press
Returns a :progress_bar leaf node. Displays a progress bar.
Props:
:progress— float 0.0 to 1.0, current progress (default: 0.0):indeterminate— boolean, shows indeterminate spinner (default: false):color— progress bar color
Returns a :refresh_control leaf node. Adds pull-to-refresh to ScrollView.
Attach as a child of :scroll node. The scroll node handles the refresh gesture.
Props:
:on_refresh—{pid, tag}tuple; fired when user pulls to refresh:refreshing— boolean, true while refresh is in progress:tint_color— color of the refresh spinner
Returns a :safe_area container node. Applies safe area insets (SafeAreaView equivalent).
Renders children within the safe area boundaries (avoiding notches, status bar, etc.).
Returns a :scroll container node. A scrollable view (ScrollView equivalent).
Props:
:horizontal— boolean, enables horizontal scrolling (default: false):on_end_reached—{pid, tag}tuple; fired when scroll reaches bottom/end:on_scroll—{pid, tag}tuple; fired during scrolling with scroll position
Returns a :status_bar leaf node. Controls the status bar appearance.
Props:
:bar_style—:default(dark text) or:light_content(light text):hidden— boolean, hides the status bar (default: false)
Returns a :switch leaf node. A boolean toggle switch.
Props:
:value— boolean, on/off state (default: false):on_toggle—{pid, tag}tuple; fires{:toggle, tag, new_value}to handler:track_color— color when switch is on:thumb_color— color of the draggable thumb
Returns a :text leaf node.
Props
:text— the string to display (required):text_color— color value passed toset_text_color/2in the NIF:text_size— font size in sp passed toset_text_size/2in the NIF
Examples
Dala.UI.text(text: "Hello")
#=> %{type: :text, props: %{text: "Hello"}, children: []}
Dala.UI.text(text: "Hello", text_color: "#ffffff", text_size: 18)
#=> %{type: :text, props: %{text: "Hello", text_color: "#ffffff", text_size: 18}, children: []}
Returns a :webview component node. Renders a native web view inline.
The JS bridge is injected automatically — the page can call window.dala.send(data)
to deliver messages to handle_info({:webview, :message, data}, socket), and
Elixir can push to JS via Dala.WebView.post_message/2.
Props:
:url— URL to load (required):allow— list of URL prefixes that navigation is permitted to (default: allow all). Blocked attempts arrive as{:webview, :blocked, url}inhandle_info.:show_url— show a native URL label above the WebView (default: false):title— static title label above the WebView; overrides:show_url:width,:height— dimensions in dp/pts; omit to fill parent