lustre_pipes/attribute

Types

The Attribute type encompasses HTML attributes, DOM properties, and event listeners.

pub type Attribute(msg) =
  attribute.Attribute(msg)

Functions

pub fn accept(
  scaffold: #(String, List(Attribute(a))),
  types: List(String),
) -> #(String, List(Attribute(a)))
pub fn accept_charset(
  scaffold: #(String, List(Attribute(a))),
  types: List(String),
) -> #(String, List(Attribute(a)))
pub fn action(
  scaffold: #(String, List(Attribute(a))),
  url: String,
) -> #(String, List(Attribute(a)))
pub fn alt(
  scaffold: #(String, List(Attribute(a))),
  text: String,
) -> #(String, List(Attribute(a)))
pub fn attribute(
  scaffold: #(String, List(Attribute(a))),
  name: String,
  value: String,
) -> #(String, List(Attribute(a)))

Create an HTML attribute. This is like saying element.setAttribute("class", "wibble") in JavaScript. Attributes will be rendered when calling element.to_string.

Note: there is a subtle difference between attributes and properties. You can read more about the implications of this here.

pub fn autocomplete(
  scaffold: #(String, List(Attribute(a))),
  name: String,
) -> #(String, List(Attribute(a)))
pub fn autofocus(
  scaffold: #(String, List(Attribute(a))),
  should_autofocus: Bool,
) -> #(String, List(Attribute(a)))
pub fn autoplay(
  scaffold: #(String, List(Attribute(a))),
  should_autoplay: Bool,
) -> #(String, List(Attribute(a)))
pub fn charset(
  scaffold: #(String, List(Attribute(a))),
  name: String,
) -> #(String, List(Attribute(a)))
pub fn checked(
  scaffold: #(String, List(Attribute(a))),
  is_checked: Bool,
) -> #(String, List(Attribute(a)))
pub fn class(
  scaffold: #(String, List(Attribute(a))),
  name: String,
) -> #(String, List(Attribute(a)))

Note: unlike most attributes, multiple class attributes are merged with any existing other classes on an element.

pub fn classes(
  scaffold: #(String, List(Attribute(a))),
  names: List(#(String, Bool)),
) -> #(String, List(Attribute(a)))
pub fn cols(
  scaffold: #(String, List(Attribute(a))),
  val: Int,
) -> #(String, List(Attribute(a)))
pub fn content(
  scaffold: #(String, List(Attribute(a))),
  text: String,
) -> #(String, List(Attribute(a)))
pub fn controls(
  scaffold: #(String, List(Attribute(a))),
  visible: Bool,
) -> #(String, List(Attribute(a)))
pub fn disabled(
  scaffold: #(String, List(Attribute(a))),
  is_disabled: Bool,
) -> #(String, List(Attribute(a)))
pub fn download(
  scaffold: #(String, List(Attribute(a))),
  filename: String,
) -> #(String, List(Attribute(a)))
pub fn enctype(
  scaffold: #(String, List(Attribute(a))),
  value: String,
) -> #(String, List(Attribute(a)))
pub fn for(
  scaffold: #(String, List(Attribute(a))),
  id: String,
) -> #(String, List(Attribute(a)))
pub fn form_action(
  scaffold: #(String, List(Attribute(a))),
  action: String,
) -> #(String, List(Attribute(a)))
pub fn form_enctype(
  scaffold: #(String, List(Attribute(a))),
  value: String,
) -> #(String, List(Attribute(a)))
pub fn form_method(
  scaffold: #(String, List(Attribute(a))),
  method: String,
) -> #(String, List(Attribute(a)))
pub fn form_novalidate(
  scaffold: #(String, List(Attribute(a))),
  value: Bool,
) -> #(String, List(Attribute(a)))
pub fn form_target(
  scaffold: #(String, List(Attribute(a))),
  target: String,
) -> #(String, List(Attribute(a)))
pub fn height(
  scaffold: #(String, List(Attribute(a))),
  val: Int,
) -> #(String, List(Attribute(a)))
pub fn href(
  scaffold: #(String, List(Attribute(a))),
  uri: String,
) -> #(String, List(Attribute(a)))
pub fn http_equiv(
  scaffold: #(String, List(Attribute(a))),
  name: String,
) -> #(String, List(Attribute(a)))
pub fn id(
  scaffold: #(String, List(Attribute(a))),
  name: String,
) -> #(String, List(Attribute(a)))
pub fn loop(
  scaffold: #(String, List(Attribute(a))),
  should_loop: Bool,
) -> #(String, List(Attribute(a)))
pub fn max(
  scaffold: #(String, List(Attribute(a))),
  val: String,
) -> #(String, List(Attribute(a)))
pub fn method(
  scaffold: #(String, List(Attribute(a))),
  method: String,
) -> #(String, List(Attribute(a)))
pub fn min(
  scaffold: #(String, List(Attribute(a))),
  val: String,
) -> #(String, List(Attribute(a)))
pub fn msg(
  scaffold: #(String, List(Attribute(a))),
  uri: String,
) -> #(String, List(Attribute(a)))
pub fn name(
  scaffold: #(String, List(Attribute(a))),
  name: String,
) -> #(String, List(Attribute(a)))
pub fn none(
  scaffold: #(String, List(Attribute(a))),
) -> #(String, List(Attribute(a)))
pub fn novalidate(
  scaffold: #(String, List(Attribute(a))),
  value: Bool,
) -> #(String, List(Attribute(a)))
pub fn on(
  scaffold: #(String, List(Attribute(a))),
  name: String,
  handler: fn(Dynamic) -> Result(a, List(DecodeError)),
) -> #(String, List(Attribute(a)))
pub fn open(
  scaffold: #(String, List(Attribute(a))),
  is_open: Bool,
) -> #(String, List(Attribute(a)))
pub fn pattern(
  scaffold: #(String, List(Attribute(a))),
  regex: String,
) -> #(String, List(Attribute(a)))
pub fn placeholder(
  scaffold: #(String, List(Attribute(a))),
  text: String,
) -> #(String, List(Attribute(a)))
pub fn property(
  scaffold: #(String, List(Attribute(a))),
  name: String,
  value: b,
) -> #(String, List(Attribute(a)))

Create a DOM property. This is like saying element.className = "wibble" in JavaScript. Properties will be not be rendered when calling element.to_string.

Note: there is a subtle difference between attributes and properties. You can read more about the implications of this here.

pub fn readonly(
  scaffold: #(String, List(Attribute(a))),
  is_readonly: Bool,
) -> #(String, List(Attribute(a)))
pub fn rel(
  scaffold: #(String, List(Attribute(a))),
  relationship: String,
) -> #(String, List(Attribute(a)))
pub fn required(
  scaffold: #(String, List(Attribute(a))),
  is_required: Bool,
) -> #(String, List(Attribute(a)))
pub fn role(
  scaffold: #(String, List(Attribute(a))),
  name: String,
) -> #(String, List(Attribute(a)))
pub fn rows(
  scaffold: #(String, List(Attribute(a))),
  val: Int,
) -> #(String, List(Attribute(a)))
pub fn selected(
  scaffold: #(String, List(Attribute(a))),
  is_selected: Bool,
) -> #(String, List(Attribute(a)))
pub fn src(
  scaffold: #(String, List(Attribute(a))),
  uri: String,
) -> #(String, List(Attribute(a)))
pub fn step(
  scaffold: #(String, List(Attribute(a))),
  val: String,
) -> #(String, List(Attribute(a)))
pub fn style(
  scaffold: #(String, List(Attribute(a))),
  properties: List(#(String, String)),
) -> #(String, List(Attribute(a)))

Note: unlike most attributes, multiple style attributes are merged with any existing other styles on an element. Styles added later in the list will override styles added earlier.

pub fn target(
  scaffold: #(String, List(Attribute(a))),
  target: String,
) -> #(String, List(Attribute(a)))
pub fn title(
  scaffold: #(String, List(Attribute(a))),
  name: String,
) -> #(String, List(Attribute(a)))
pub fn type_(
  scaffold: #(String, List(Attribute(a))),
  name: String,
) -> #(String, List(Attribute(a)))
pub fn value(
  scaffold: #(String, List(Attribute(a))),
  val: String,
) -> #(String, List(Attribute(a)))
pub fn width(
  scaffold: #(String, List(Attribute(a))),
  val: Int,
) -> #(String, List(Attribute(a)))
pub fn wrap(
  scaffold: #(String, List(Attribute(a))),
  mode: String,
) -> #(String, List(Attribute(a)))
Search Document