Corex.Content (Corex v0.1.0-beta.5)

View Source

Content items for components with trigger/content patterns to be used with:

Use Corex.Content.new/1 to build a list of items from maps or keyword lists.

Summary

Functions

Creates a list of Content.Item structs from a list of maps or keyword lists.

Functions

new(items)

@spec new(list()) :: [Corex.Content.Item.t()]

Creates a list of Content.Item structs from a list of maps or keyword lists.

Fields

  • :label - (required) Text shown in the trigger/header region
  • :content - (required) Content to display in the content area
  • :value - (optional) Unique identifier (item-1, item-2, … when omitted)
  • :disabled - (optional) Whether the item is disabled, defaults to false
  • :meta - (optional) Additional metadata map for the item

Examples

Corex.Content.new([
  %{label: "Lorem ipsum dolor sit amet", content: "Consectetur adipiscing elit."},
  %{value: "duis", label: "Duis", content: "Nullam eget vestibulum ligula."},
  %{value: "donec", label: "Donec", content: "Congue molestie ipsum gravida a.", disabled: true}
])

Raises ArgumentError if items is not a list of maps or keyword lists.