Product picture
A product picture without image files: the product's SVG drawing on a coloured tile.
zb:shop.product-visual zubazar/ui-pro
This component is in Zubazar UI Pro; Zubazar UI Pro brings Zubazar UI with it. Installing Zubazar UI Pro →
Product picture
The picture fills its box; class sets the size and the ratio, shape the drawing and hue the colour family.
<zb:shop.product-visual shape="headphones" hue="violet" label="Aura Wireless Headphones" class="aspect-square w-56 rounded-sm" />
| Prop | Values |
|---|---|
shape | The drawing's name; default box |
hue | The colour family; default violet |
view | 0 front · 1 close · 2 detail |
label | The name screen readers hear |
Drawings
The package comes with 23 drawings; an unknown name draws the box (box).
<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
The nine colour families set the tones of the tile and the drawing.
<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
Give the picture a ratio or a height with class; without one it does not show.
<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?
| Prop | Type | Default | Description |
|---|---|---|---|
shape | — | box | The drawing's name: a file under components/shapes (headphones, mug…) |
hue | — | violet | violet · rose · pink · orange · amber · green · teal · sky · slate |
view | number | 0 | The gallery angle: 0 front · 1 tilted and close · 2 detail |
label | — | null | The name screen readers hear; without it the picture is decorative |
Advanced
Angles
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.
<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
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.
{{-- 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
- The product card, the product page's gallery, the cart, the order summary, the category cards and the mega menu use this picture.
- The
visualfield 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/shapesfolder; in a drawing of your own the floor shadow is at y=170.