Skip to content

Vue 3 UI Kit

@rtcstack/ui-vue provides a drop-in <VideoConference> component and composables for custom Vue 3 UIs.

Installation

bash
pnpm add @rtcstack/ui-vue @rtcstack/sdk livekit-client

Drop-in Usage

vue
<script setup lang="ts">
import { createCall } from '@rtcstack/sdk'
import { VideoConference } from '@rtcstack/ui-vue'
import '@rtcstack/ui-vue/styles.css'

const call = createCall({ token, url })
await call.connect()
</script>

<template>
  <VideoConference :call="call" @leave="call.disconnect()" />
</template>

Props

PropTypeDescription
callCallA Call instance from createCall()
theme'dark' | 'light'Color theme (default: 'dark')
showChatbooleanShow chat panel initially (default: false)

Events

EventDescription
@leaveEmitted when the user clicks Leave

Composables

All composables must be used inside a component that is a descendant of <VideoConference> or a component that calls provide(CALL_KEY, call).

useCall()

ts
import { useCall } from '@rtcstack/ui-vue'
const call = useCall()  // Call instance

useConnectionState()

ts
const state = useConnectionState()  // Ref<ConnectionState>

useParticipants()

ts
const participants = useParticipants()  // Ref<Participant[]>

useLocalParticipant()

ts
const local = useLocalParticipant()  // Ref<Participant | null>

useActiveSpeakers()

ts
const speakers = useActiveSpeakers()  // Ref<Participant[]>

useMessages()

ts
const messages = useMessages()  // Ref<Message[]>

useDevices()

ts
const devices = useDevices()
// Ref<{ audioinput, audiooutput, videoinput: MediaDeviceInfo[] }>

Building a Custom UI

vue
<script setup lang="ts">
import { provide } from 'vue'
import { CALL_KEY, useParticipants, useMediaControls } from '@rtcstack/ui-vue'

const props = defineProps<{ call: Call }>()
provide(CALL_KEY, props.call)
</script>

<template>
  <MyGrid />
  <MyControls />
</template>
vue
<!-- MyGrid.vue -->
<script setup lang="ts">
import { useParticipants } from '@rtcstack/ui-vue'
const participants = useParticipants()
</script>

<template>
  <div class="grid">
    <div v-for="p in participants" :key="p.id">{{ p.name }}</div>
  </div>
</template>

Atomic Components

ComponentDescription
<VideoConference>Full drop-in conference
<VideoGrid>Participant video grid
<ControlBar>Mic/camera/screen/leave controls
<ChatPanel>Scrolling chat with input
<ParticipantVideo>Single participant tile

Theming

The Vue kit uses the same CSS custom properties as the React kit. Import the shared stylesheet and override tokens:

css
:root {
  --rtc-accent: #your-brand-color;
}

See Theming for the full token list.