Skip to content

Instantly share code, notes, and snippets.

@KonnorRogers
Created November 2, 2024 19:59
Show Gist options
  • Save KonnorRogers/b08f3d5b981ac2e38a3fe765bf1b4680 to your computer and use it in GitHub Desktop.
Save KonnorRogers/b08f3d5b981ac2e38a3fe765bf1b4680 to your computer and use it in GitHub Desktop.
Phlex dump of CLI
class SlButton < Phlex::HTML
register_element :sl_button
def initialize(
caret: false,
circle: false,
disabled: false,
download: nil,
form: nil,
formaction: nil,
formenctype: nil,
formmethod: nil,
formnovalidate: nil,
formtarget: nil,
href: '',
loading: false,
name: '',
outline: false,
pill: false,
rel: 'noreferrer noopener',
size: 'medium',
target: nil,
title: '',
type: 'button',
value: '',
variant: 'default',
**attributes
)
@attributes = attributes.with_defaults({
caret: caret,
circle: circle,
disabled: disabled,
download: download,
form: form,
formaction: formaction,
formenctype: formenctype,
formmethod: formmethod,
formnovalidate: formnovalidate,
formtarget: formtarget,
href: href,
loading: loading,
name: name,
outline: outline,
pill: pill,
rel: rel,
size: size,
target: target,
title: title,
type: type,
value: value,
variant: variant
})
end
def view_template(&)
sl_button(**@attributes, &)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment