class Primer::Alpha::Image
Always provide a meaningful ‘alt`.
@accessibility
Use `Image` to render images.
def call
def call render(Primer::BaseComponent.new(src: image_path(@src), **@system_arguments)) end
def initialize(src:, alt:, lazy: false, **system_arguments)
-
system_arguments
(Hash
) -- <%= link_to_system_arguments_docs %> -
lazy
(Boolean
) -- Whether or not to lazily load the image. -
alt
(String
) -- Specifies an alternate text for the image. -
src
(String
) -- The source url of the image.
def initialize(src:, alt:, lazy: false, **system_arguments) @system_arguments = deny_tag_argument(**system_arguments) @src = src @system_arguments[:tag] = :img @system_arguments[:alt] = alt return unless lazy @system_arguments[:loading] = :lazy @system_arguments[:decoding] = :async end