Skip to content

Commit 5c27eec

Browse files
Class attribute type (#6398)
* update core components class attribute * update class attribute in guide
1 parent caa7be3 commit 5c27eec

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

guides/asset_management.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ setting width, height, and background color classes.
325325
<.icon name="ri-github" class="ml-1 w-3 h-3 animate-spin" />
326326
"""
327327
attr :name, :string, required: true
328-
attr :class, :string, default: "size-5"
328+
attr :class, :any, default: "size-5"
329329
330330
def icon(%{name: "ri-" <> _} = assigns) do
331331
~H"""

installer/templates/phx_web/components/core_components.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ defmodule <%= @web_namespace %>.CoreComponents do
9090
<.button navigate={~p"/"}>Home</.button>
9191
"""
9292
attr :rest, :global, include: ~w(href navigate patch method download name value disabled)
93-
attr :class, :string
93+
attr :class, :any
9494
attr :variant, :string, values: ~w(primary)
9595
slot :inner_block, required: true
9696

@@ -161,8 +161,8 @@ defmodule <%= @web_namespace %>.CoreComponents do
161161
attr :prompt, :string, default: nil, doc: "the prompt for select inputs"
162162
attr :options, :list, doc: "the options to pass to Phoenix.HTML.Form.options_for_select/2"
163163
attr :multiple, :boolean, default: false, doc: "the multiple flag for select inputs"
164-
attr :class, :string, default: nil, doc: "the input class to use over defaults"
165-
attr :error_class, :string, default: nil, doc: "the input error class to use over defaults"
164+
attr :class, :any, default: nil, doc: "the input class to use over defaults"
165+
attr :error_class, :any, default: nil, doc: "the input error class to use over defaults"
166166

167167
attr :rest, :global,
168168
include: ~w(accept autocomplete capture cols disabled form list max maxlength min minlength
@@ -412,7 +412,7 @@ defmodule <%= @web_namespace %>.CoreComponents do
412412
<.icon name="hero-arrow-path" class="ml-1 size-3 motion-safe:animate-spin" />
413413
"""
414414
attr :name, :string, required: true
415-
attr :class, :string, default: "size-4"
415+
attr :class, :any, default: "size-4"
416416

417417
def icon(%{name: "hero-" <> _} = assigns) do
418418
~H"""

0 commit comments

Comments
 (0)