Banners

TsBannerWithThreeSegments

Component Code

<template>
  <div class="ts-banner p-4 relative w-full overflow-hidden bg-no-repeat bg-cover" :style="root_styles">
    <slot>
      <TsMedia
          append-class="items-stretch"
          :style="container_styles"
      >
        <TsMediaStart>
          <Blocks
              class="w-full h-full"
              :parent="props.builderBlock?.id"
              :path="`component.options.leftBlocks`"
              :blocks="props.leftBlocks"
          />
        </TsMediaStart>
        <TsMediaContent>
          <Blocks
              class="w-full h-full"
              :parent="props.builderBlock?.id"
              :path="`component.options.middleBlocks`"
              :blocks="props.middleBlocks"
          />
        </TsMediaContent>
        <TsMediaEnd>
          <Blocks
              class="w-full h-full"
              :parent="props.builderBlock?.id"
              :path="`component.options.rightBlocks`"
              :blocks="props.rightBlocks"
          />
        </TsMediaEnd>
      </TsMedia>
    </slot>
  </div>
</template>

<script setup lang="ts">
import { Blocks } from '@builder.io/sdk-vue';

type Props = {
  builderBlock?: object;
  leftBlocks?: object[] | object;
  middleBlocks?: object[] | object;
  rightBlocks?: object[] | object;
  background?: object;
}

const props = withDefaults(defineProps<Props>(), {
  background: () => ({
    image: {
      src: '/banners/desktop/banner-yellow-background.png'
    }
  })
});

const root_styles = computed(() => ({
  ...(props.background && (props.background.borderRadius || props.background.borderRadius === 0) &&  {borderRadius: `${props.background.borderRadius}px`}),
  ...((props.background && props.background.image && props.background.image.src) ?  {backgroundImage: `url(${props.background.image.src})`} : {backgroundImage: `url(/banners/desktop/banner-yellow-background.png)`}),
}))

const container_styles = computed(() => ({
  ...(props.background && props.background.overlay &&  {backgroundColor: props.background.overlay}),
}));

</script>

Usage in Builder

  1. Go to the insert tab.
  2. Search bannerwiththreesegments in search bar.
  3. Hold bannerwiththreesegments component & drag where you want to use.

Props

NameTypeDefaultDescription
backgroundobject""It has keys which are: image - object, overlay - string, borderRadius - number. image has src - string, altText - string. src is used to add the url of image, altText is used to add alt text to the image., overlay is used to add the overlay color, borderRadius is used to add border radius to the root container.

Copyright © 2026