Scenic.Component.Input.RadioGroup (Scenic v0.10.3) View Source

Add a radio group to a graph



  • radio_buttons must be a list of radio button data. See below.

Radio button data:

{text, radio_id, checked? \\ false}

  • text - must be a bitstring
  • button_id - can be any term you want. It will be passed back to you as the group's value.
  • checked? - must be a boolean and indicates if the button is selected. checked? is not required and will default to false if not supplied.


When the state of the radio group changes, it sends an event message to the host scene in the form of:

{:value_changed, id, radio_id}


Radio Buttons honor the following list of options.

  • :theme - This sets the color scheme of the button. This can be one of pre-defined button schemes :light, :dark, or it can be a completely custom scheme like this: {text_color, box_background, border_color, pressed_color, checkmark_color}.


Radio Buttons honor the following styles

  • :hidden - If false the component is rendered. If true, it is skipped. The default is false.
  • :theme - The color set used to draw. See below. The default is :dark


Radio buttons work well with the following predefined themes: :light, :dark

To pass in a custom theme, supply a map with at least the following entries:

  • :text - the color of the text
  • :background - the background of the component
  • :border - the border of the component
  • :active - the background of the circle while the button is pressed
  • :thumb - the color of inner selected-mark


You should add/modify components via the helper functions in Scenic.Components


The following example creates a radio group and positions it on the screen.

|> radio_group([
    {"Radio A", :radio_a},
    {"Radio B", :radio_b, true},
    {"Radio C", :radio_c},
  ], id: :radio_group_id, translate: {20, 20})

Link to this section Summary

Link to this section Functions

Link to this function

add_to_graph(graph, data \\ nil, opts \\ [])

View Source


add_to_graph(graph :: Scenic.Graph.t(), data :: any(), opts :: list()) ::

Callback implementation for Scenic.Component.add_to_graph/3.