Blocks

AI media

Beyond chat: make images, read text aloud, turn speech into text, and make short videos. Each works with any provider TanStack AI supports.

Examples

Images

Describe an image, pick a shape and generate two. The demo draws star patterns colored by your words; your app shows the model's images.

Shape

Your images appear here.

<script lang="ts">
	import ImageStudio from '#lib/blocks/media/ImageStudio.svelte';
	// In your app: connection={fetchServerSentEvents('/api/image')}.
	import { demoImages } from './demo-media';
</script>

<ImageStudio fetcher={demoImages} placeholder="A tiled courtyard floor in Isfahan, morning light" />

Read aloud

Turns text into speech and plays it as soon as it's ready. In this demo a short melody stands in for the voice.

Voice
<script lang="ts">
	import SpeechStudio from '#lib/blocks/media/SpeechStudio.svelte';
	// In your app: connection={fetchServerSentEvents('/api/speech')}.
	import { demoSpeech } from './demo-media';
</script>

<SpeechStudio
	fetcher={demoSpeech}
	text="Knowledge is a tree whose roots are in study and whose fruit is in practice."
/>

Transcribe

Record from the microphone, or upload a recording, and get the words back as text. The demo returns a fixed line.

This browser can't record; upload a recording instead.

<script lang="ts">
	import Transcriber from '#lib/blocks/media/Transcriber.svelte';
	// In your app: connection={fetchServerSentEvents('/api/transcribe')}.
	import { demoTranscribe } from './demo-media';
</script>

<Transcriber fetcher={demoTranscribe} />

Video

Describe a scene and choose a length. The demo records a turning star pattern; your app shows the model's video.

Length

Your video appears here.

<script lang="ts">
	import VideoStudio from '#lib/blocks/media/VideoStudio.svelte';
	// In your app: connection={fetchServerSentEvents('/api/video')}.
	import { demoVideo } from './demo-media';
</script>

<VideoStudio fetcher={demoVideo} placeholder="Stars turning over the observatory at Maragheh" />

Installation

npx sinaui add blocks/media

Props

BlockProps
ImageStudioconnection or fetcher, count (2), placeholder
SpeechStudioconnection or fetcher, voices, text (bindable)
Transcriberconnection or fetcher
VideoStudioconnection or fetcher, placeholder

Accessibility

  • Results are announced when ready; the areas they appear in are busy while working.
  • Every generation can be stopped part way.
  • The record button says whether it's recording; a blocked microphone is explained, with upload offered instead.
  • The player's position is a slider read as elapsed and total time.
Introduction
Theming
Changelog
Button
Action button
Confirm button
Copy button
Hold to confirm
Split button
Calendar
Checkbox
Color picker
Combobox
Date picker
Date range picker
File drop
Form
Input
Mention input
Multi select
Number field
OTP input
Password input
Phone input
Radio cards
Radio group
Rich text editor
Search field
Segmented control
Select
Signature pad
Slider
Switch
Tag input
Upload
Wheel picker
Textarea
Time field
Toggle group
Toolbar
Alert dialog
Command palette
Context menu
Dialog
Drawer
Dropdown
Hover card
Popover
Tooltip
Announcement bar
Alert
Empty state
Meter
Progress
Rolling number
Skeleton
Spinner
Toast
Avatar
Avatar group
Badge
Card
Carousel
Chart
Chat
Code block
Data table
Folder
Kbd
Mind map
Resizable panels
Scroll area
Separator
Sortable
Table
Tag group
Virtual list
Audio player
Image
Image compare
Video
Visualizer
Breadcrumb
File tree
Menubar
Navigation menu
Pagination
Sidebar layout
Stepper
Tabs
Alarm clock
Clock
Dynamic island
Fluid orb
Hourglass
Stopwatch
Timer
AI chat
AI media
Auth
Board
Booking
Dashboard
File explorer
Messaging
Notifications
Settings
Team
Overview
Pricing
Agent chat
Calendar
Voice agent
Mail inbox
CMS
Blog
Marketing site
E-commerce
AI agents
SaaS landing page
SaaS app
Accordion
Dark theme
Light theme