Sha256: 606a596f53313dd5f77f3fd6794cf8a72b5c31653cb7808cc1628440704c1f16
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true module Components class Tabs class Tab < Phlex::View def initialize(name:, checked:) @name = name @checked = checked end def template(&block) input class: "opacity-0 fixed peer", type: "radio", name: @_parent.unique_identifier, id: unique_identifier, checked: @checked label @name, id: "#{unique_identifier}-label", for: unique_identifier, role: "tab", aria_controls: "#{unique_identifier}-panel", class: "order-1 py-2 px-5 bg-white text-sm border border-b-0 border-l-0 font-medium first-of-type:border-l first-of-type:rounded-tl last-of-type:rounded-tr before:absolute before:pointer-events-none before:w-full before:ring before:h-full before:left-0 before:top-0 before:hidden before:rounded peer-focus:before:block cursor-pointer" div id: "#{unique_identifier}-panel", role: "tabpanel", aria_labelledby: "#{unique_identifier}-label", class: "tab hidden order-2 w-full border rounded-b rounded-tr overflow-hidden" do @_parent.instance_exec(&block) end end def unique_identifier @unique_identifier ||= SecureRandom.hex end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
phlex-0.3.2 | docs/components/tabs/tab.rb |
phlex-0.3.1 | docs/components/tabs/tab.rb |
phlex-0.3.0 | docs/components/tabs/tab.rb |