edutap.ai developers
SDK Integration

Styling

Customizing TapKit UI styles

Styling

TapKit can be sized freely using the style attribute, just like any HTML element.

Basic Usage

Specify size directly in HTML:

<tap-kit
  style="width: 400px; height: 500px;"
  user-id="..."
  course-id="..."
  clip-id="..."
></tap-kit>

You can also change it dynamically with JavaScript:

const kit = document.querySelector('tap-kit');
kit.style.width = '100%';
kit.style.height = '400px';

The height value in your style attribute is applied as-is. A minimum height of 350px is recommended so the chat input remains visible.


Display Modes

TapKit supports 3 display modes.

ModeDescriptionPositioning
inlineEmbed in page content (default)Declared location
floatingCompact widgetposition: fixed
sidebarFull-height sidebarposition: fixed
<tap-kit mode="inline" ...></tap-kit>
<tap-kit mode="floating" ...></tap-kit>
<tap-kit mode="sidebar" ...></tap-kit>

Inline Mode (Default)

Inline mode embeds naturally into page content.

<tap-kit
  style="width: 100%; height: 500px;"
  user-id="..."
  course-id="..."
  clip-id="..."
></tap-kit>
<style>
  .app-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    height: 100vh;
  }
</style>

<div class="app-layout">
  <main><!-- Course content --></main>
  <tap-kit
    style="width: 100%; height: 100%;"
    user-id="..."
    course-id="..."
    clip-id="..."
  ></tap-kit>
</div>

Floating Mode

Floating mode is fixed on screen with position: fixed.

<tap-kit
  mode="floating"
  style="width: 380px; height: 600px;"
  user-id="..."
  course-id="..."
  clip-id="..."
></tap-kit>

In Floating/Sidebar modes, the SDK automatically manages positioning. Adjust only the size via style attribute if needed.


Sidebar mode displays at full height on the right side of the screen.

<tap-kit
  mode="sidebar"
  user-id="..."
  course-id="..."
  clip-id="..."
></tap-kit>

Users can drag to adjust width.

Layout Toggle

By default, users can switch between Floating ↔ Sidebar modes. To disable this:

<tap-kit mode="floating" allow-layout-toggle="false" ...></tap-kit>
kit.allowLayoutToggle = false;

Responsive Design

Use media queries for responsive sizing.

<style>
  tap-kit {
    width: 100%;
    height: 500px;
  }

  @media (min-width: 768px) {
    tap-kit {
      width: 500px;
      height: 700px;
    }
  }
</style>

<tap-kit user-id="..." course-id="..." clip-id="..."></tap-kit>

CSS Variables

TapKit provides CSS Variables for customizing layout. Use these to override default values.

Floating Mode Variables

VariableDefaultDescription
--tap-floating-width430pxContainer width
--tap-floating-heightcalc(100% - 116px)Container height
--tap-floating-top50pxTop position
--tap-floating-right20pxRight position
--tap-floating-bottomautoBottom position
--tap-floating-leftautoLeft position
--tap-floating-border-radius10pxBorder radius
--tap-floating-shadow(complex)Box shadow
VariableDefaultDescription
--tap-sidebar-widthmin(50%, 600px)Max width
--tap-sidebar-border1px solid #B8B9B9Left border

Inline Mode Variables

VariableDefaultDescription
--tap-kit-width100%Container width
--tap-kit-height100%Container height
--tap-kit-min-width300pxMinimum width
--tap-kit-min-height600pxMinimum height

Usage Examples

/* Adjust floating width */
tap-kit {
  --tap-floating-width: 380px;
}

/* Responsive floating */
@media (max-width: 768px) {
  tap-kit {
    --tap-floating-width: 100%;
    --tap-floating-right: 0;
    --tap-floating-border-radius: 0;
  }
}

/* Wider sidebar */
tap-kit {
  --tap-sidebar-width: min(60%, 800px);
}

CSS Variables provide the cleanest way to customize TapKit's appearance. They work with all display modes and are the recommended approach over inline styles.


Mode Comparison

FeatureInline ModeFloating/Sidebar Mode
PositioningInside page contentFloating on screen (fixed)
Position controlDepends on parentSDK auto-managed
Layout impactYesNo
Use caseSidebar, content sectionChat widget
Default✅ v2.0+

tap-button Styling

The <tap-button> element can be customized through CSS Shadow Parts.

Basic Attributes

<!-- Adjust position and size -->
<tap-button
  position="bottom-right"
  size="large"
></tap-button>
AttributeValuesDescription
positionbottom-right, bottom-left, top-right, top-left, customButton position
sizesmall (48px), medium (56px), large (64px)Button size
floatingtrue, falseFixed/floating mode

CSS Shadow Parts

Modify button styles with external CSS.

/* Customize button styles */
tap-button::part(button) {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

tap-button::part(button):hover {
  transform: scale(1.1);
}

/* Customize tooltip styles */
tap-button::part(tooltip) {
  background: #1f2937;
  color: white;
  border-radius: 12px;
}

Custom Icon

Use slots to replace the default icon.

<tap-button position="bottom-right">
  <img src="/my-tutor-icon.svg" alt="AI Tutor" />
</tap-button>

Static Mode (Non-floating)

Use floating="false" to place in normal document flow.

<div class="button-container">
  <tap-button floating="false" size="medium"></tap-button>
</div>

In floating="false" mode, the button renders with position: static, placed like a normal element within its parent.


Next Steps