v0.0.2
Demos (demo panel, opens in a new tab)

Product picture

A product picture without image files: the product's SVG drawing on a coloured tile.

zb:shop.product-visual zubazar/ui-pro

PRO

This component is in Zubazar UI Pro; Zubazar UI Pro brings Zubazar UI with it. Installing Zubazar UI Pro →

Product picture

Product picture: view
BLADE

The picture fills its box; class sets the size and the ratio, shape the drawing and hue the colour family.

blade
<zb:shop.product-visual shape="headphones" hue="violet" label="Aura Wireless Headphones" class="aspect-square w-56 rounded-sm" />
PropValues
shapeThe drawing's name; default box
hueThe colour family; default violet
view0 front · 1 close · 2 detail
labelThe name screen readers hear

Drawings

Drawings: view
BLADE

The package comes with 23 drawings; an unknown name draws the box (box).

blade
<div class="grid grid-cols-4 gap-3 sm:grid-cols-6">
    @foreach (['backpack', 'board', 'book', 'bottle', 'box', 'camera', 'candle', 'dumbbell', 'headphones', 'lamp', 'mat', 'mug', 'notebook', 'pen', 'perfume', 'plant', 'serum', 'sneaker', 'speaker', 'sunglasses', 'teapot', 'tshirt', 'watch'] as $shape)
        <figure>
            <zb:shop.product-visual :shape="$shape" class="aspect-square rounded-sm" />
            <figcaption class="mt-1.5 text-center font-mono text-xs text-muted">{{ $shape }}</figcaption>
        </figure>
    @endforeach
</div>

Colour families

Colour families: view
BLADE

The nine colour families set the tones of the tile and the drawing.

blade
<div class="grid grid-cols-3 gap-3 sm:grid-cols-9">
    @foreach (['violet', 'rose', 'pink', 'orange', 'amber', 'green', 'teal', 'sky', 'slate'] as $hue)
        <figure>
            <zb:shop.product-visual shape="mug" :hue="$hue" class="aspect-square rounded-sm" />
            <figcaption class="mt-1.5 text-center font-mono text-xs text-muted">{{ $hue }}</figcaption>
        </figure>
    @endforeach
</div>

Size and shape

Size and shape: view
BLADE

Give the picture a ratio or a height with class; without one it does not show.

blade
<div class="flex flex-wrap items-end gap-6">
    <zb:shop.product-visual shape="mug" hue="sky" class="size-14 rounded-sm" />
    <zb:shop.product-visual shape="sneaker" hue="pink" class="size-24 rounded-full" />
    <zb:shop.product-visual shape="lamp" hue="amber" class="aspect-[16/9] w-64 rounded-sm" />
</div>

Props

The values the component takes. What are props and slots?

PropTypeDefaultDescription
shape—boxThe drawing's name: a file under components/shapes (headphones, mug…)
hue—violetviolet · rose · pink · orange · amber · green · teal · sky · slate
viewnumber0The gallery angle: 0 front · 1 tilted and close · 2 detail
label—nullThe name screen readers hear; without it the picture is decorative

Advanced

2 examples

Angles

Angles: view
BLADE

The product page's gallery shows the same drawing from three angles: view 0 from the front, 1 tilted and closer, 2 an enlarged detail; each angle has its own tile decoration.

blade
<div class="grid max-w-md grid-cols-3 gap-3">
    @foreach (['Front view', 'Close-up', 'Detail'] as $view => $viewLabel)
        <zb:shop.product-visual :shape="$product->shape" :hue="$product->hue" :view="$view" :label="$product->name.' · '.$viewLabel" class="aspect-square rounded-sm" />
    @endforeach
</div>

A drawing of your own

BLADE

For a product the list does not cover, add a drawing under resources/views/vendor/zubazar-ui-pro/components/shop/shapes; the file's name is the shape value. The drawing is made for a 200×200 area and takes its colours from the --pv-main, --pv-dark and --pv-light variables.

blade
{{-- resources/views/vendor/zubazar-ui-pro/components/shop/shapes/tablet.blade.php --}}
<rect x="52" y="44" width="96" height="124" rx="12" fill="var(--pv-dark)" />
<rect x="60" y="54" width="80" height="100" rx="4" fill="var(--pv-light)" />
<circle cx="100" cy="161" r="3.5" fill="var(--pv-main)" />
<path d="M68 64 h24" stroke="#fff" stroke-width="4" stroke-linecap="round" opacity=".5" />

{{-- Using it --}}
<zb:shop.product-visual shape="tablet" hue="teal" class="aspect-square w-56" />

Developer notes

Events, hooks and details
  • The product card, the product page's gallery, the cart, the order summary, the category cards and the mega menu use this picture.
  • The visual field of the product's data picks the drawing and the colour family; the product card takes the drawing with :shape="$product->shape".
  • In dark mode the tile darkens and the decorations fade.
  • The drawings are in the components/shapes folder; in a drawing of your own the floor shadow is at y=170.
Zubazar UI · ZubazarDesigned for people.