module Coco class ModalLightbox < Coco::Component include Concerns::AcceptsOptions renders_one :image, ->(scroll_top: 0, **kwargs) do coco_image( x: {"on:load": "imageLoaded"}, data: {scroll_top: scroll_top.to_i, role: "image"}, **kwargs ) end before_render do unless image? raise ArgumentError, "An image is required for the lightbox" end end end end