Shape

v0.0.10

v0.0.10StableComponentStatelessApache-2.0
Installation mix mishka.ui.gen.component shape
Source View Source

Overview of the Shape Component

The Shape component clips its content to a chosen geometric outline. Available shapes: squircle, circle, square, heart, star, star_alt, diamond, pentagon, hexagon, hexagon_alt, decagon, triangle, triangle_down, triangle_left, triangle_right.

Basic usage with image

Basic usage with image

Mishka logo
squircle
Mishka logo
circle
Mishka logo
hexagon
Mishka logo
heart
Mishka logo
star
Mishka logo
diamond
heex
<.shape variant="squircle" src="/avatar.jpg" alt="User avatar" />

All 15 shapes

All 15 shapes

squircle
circle
square
heart
star
star_alt
diamond
pentagon
hexagon
hexagon_alt
decagon
triangle
triangle_down
triangle_left
triangle_right
heex
<.shape :for={shape <- @shapes} variant={shape} size="medium" src="..." />

Sizes

Sizes

heex
<.shape variant="circle" size="extra_small" src="..." />
<.shape variant="circle" size="small" src="..." />
<.shape variant="circle" size="medium" src="..." />
<.shape variant="circle" size="large" src="..." />
<.shape variant="circle" size="extra_large" src="..." />

Half mode

Use half="first" or half="second" to render only half of the shape, which is useful for split / hover reveals.

Half mode

heex
<.shape variant="hexagon" half="first" src="..." />
<.shape variant="hexagon" half="second" src="..." />

Custom content (slot)

Skip src and pass a slot to clip any HEEx content (gradients, video, avatar initials, etc.) to the shape.

Custom content (slot)

AB
heex
<.shape variant="hexagon" size="large">
  <div class="bg-gradient-to-br from-primary-light to-primary-dark size-full
              flex items-center justify-center text-white">
    AB
  </div>
</.shape>