Skip to main content
userTourKit
@tour-kit/surveysComponents

SurveyBanner

Top or bottom strip that renders when the survey is visible, with sticky positioning, intent variants, and an optional dismiss button

domidex01Published Updated

SurveyBanner renders a horizontal strip at the top or bottom of the viewport. It returns null when survey.state.isVisible is false, so no portal or dialog wrapping is needed.

Import

import { SurveyBanner } from '@tour-kit/surveys';

Usage

import { SurveyBanner, QuestionBoolean, useSurvey } from '@tour-kit/surveys';

function FeedbackBanner() {
  const survey = useSurvey('quick-csat');

  return (
    <SurveyBanner
      surveyId="quick-csat"
      position="top"
      sticky
      intent="feedback"
    >
      <QuestionBoolean
        id="satisfied"
        label="Are you satisfied with this page?"
        yesLabel="Yes"
        noLabel="No"
        onChange={(value) => {
          survey.answer('satisfied', value);
          survey.complete();
        }}
      />
    </SurveyBanner>
  );
}

Props

Prop

Type

Variants

VariantValuesDefault
position'top' 'bottom''top'
intent'info' 'feedback''info'
stickytrue falsefalse

Compound variant: position='top' + sticky=truetop-0; position='bottom' + sticky=truebottom-0.

BannerOptions defaults

{
  position: 'top',
  sticky: false,
  dismissable: true,
  intent: 'info',
}

The dismissable option controls whether the dismiss button renders. Clicking it calls survey.dismiss('close_button').