Comprehensive cross-platform component library that forms part of the Taro framework, providing 96 UI components that follow WeChat Mini Program standards while supporting React and Vue frameworks.
—
Multimedia components for handling audio, video, camera, live streaming, and image display functionality.
Image display component with lazy loading, error handling, and various display modes.
/**
* Image display component with lazy loading
* @supported all platforms
*/
const Image: ComponentType<ImageProps>;
interface ImageProps extends StandardProps {
/** Image source URL or local path
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid
*/
src?: string;
/** Image display mode
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid
* @default "scaleToFill"
*/
mode?: keyof ImageProps.Mode;
/** Whether to enable lazy loading
* @supported weapp, alipay, swan, tt, qq, jd, h5
* @default false
*/
lazyLoad?: boolean;
/** Whether to enable fade-in animation
* @supported weapp, tt, qq, jd
* @default true
*/
fadeIn?: boolean;
/** Whether to enable webp format
* @supported weapp, tt, qq, jd
* @default false
*/
webp?: boolean;
/** Whether to show menu on long press
* @supported weapp, tt, qq, jd
* @default true
*/
showMenuByLongpress?: boolean;
/** Image load callback */
onLoad?: (event: ImageLoadEvent) => void;
/** Image error callback */
onError?: (event: ImageErrorEvent) => void;
}
declare namespace ImageProps {
interface Mode {
/** Scale to fill the container */
scaleToFill: '';
/** Scale maintaining aspect ratio */
aspectFit: '';
/** Scale to fill, may crop */
aspectFill: '';
/** Keep original size centered */
center: '';
/** Top alignment */
top: '';
/** Bottom alignment */
bottom: '';
/** Left alignment */
left: '';
/** Right alignment */
right: '';
/** Top left alignment */
'top left': '';
/** Top right alignment */
'top right': '';
/** Bottom left alignment */
'bottom left': '';
/** Bottom right alignment */
'bottom right': '';
}
}Video player component with full controls and platform-specific features.
/**
* Video player component with full controls
* @supported all platforms
*/
const Video: ComponentType<VideoProps>;
interface VideoProps extends StandardProps {
/** Video source URL
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid
*/
src?: string;
/** Video duration in seconds
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
duration?: number;
/** Whether controls are shown
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid
* @default true
*/
controls?: boolean;
/** Whether to enable danmu (bullet comments)
* @supported weapp, tt, qq, jd
* @default false
*/
danmuBtn?: boolean;
/** Whether to enable full screen
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
* @default true
*/
enableFullScreen?: boolean;
/** Whether to autoplay
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid
* @default false
*/
autoplay?: boolean;
/** Whether to loop playback
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid
* @default false
*/
loop?: boolean;
/** Whether to mute
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid
* @default false
*/
muted?: boolean;
/** Initial playback time
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
* @default 0
*/
initialTime?: number;
/** Page gesture for full screen
* @supported weapp, tt, qq, jd
* @default false
*/
pageGesture?: boolean;
/** Full screen direction
* @supported weapp, tt, qq, jd
* @default 90
*/
direction?: number;
/** Whether to show progress
* @supported weapp, tt, qq, jd
* @default true
*/
showProgress?: boolean;
/** Whether to show fullscreen button
* @supported weapp, tt, qq, jd
* @default true
*/
showFullscreenBtn?: boolean;
/** Whether to show play button
* @supported weapp, tt, qq, jd
* @default true
*/
showPlayBtn?: boolean;
/** Whether to show center play button
* @supported weapp, tt, qq, jd
* @default true
*/
showCenterPlayBtn?: boolean;
/** Whether to enable progress gesture
* @supported weapp, tt, qq, jd
* @default true
*/
enableProgressGesture?: boolean;
/** Object fit mode
* @supported weapp, tt, qq, jd
* @default "contain"
*/
objectFit?: 'contain' | 'fill' | 'cover';
/** Poster image URL
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid
*/
poster?: string;
/** Whether to show mute button
* @supported weapp, tt, qq, jd
* @default false
*/
showMuteBtn?: boolean;
/** Video title
* @supported weapp, tt, qq, jd
*/
title?: string;
/** Play button position
* @supported weapp, tt, qq, jd
* @default "bottom"
*/
playBtnPosition?: 'bottom' | 'center';
/** Whether to enable play gesture
* @supported weapp, tt, qq, jd
* @default false
*/
enablePlayGesture?: boolean;
/** Whether to auto pause other videos
* @supported weapp, tt, qq, jd
* @default true
*/
autoPauseIfNavigate?: boolean;
/** Whether to auto pause when opening app
* @supported weapp, tt, qq, jd
* @default true
*/
autoPauseIfOpenNative?: boolean;
/** Video metadata load callback */
onLoadedMetadata?: (event: VideoLoadedMetadataEvent) => void;
/** Video play callback */
onPlay?: (event: TaroEvent) => void;
/** Video pause callback */
onPause?: (event: TaroEvent) => void;
/** Video end callback */
onEnded?: (event: TaroEvent) => void;
/** Video time update callback */
onTimeUpdate?: (event: VideoTimeUpdateEvent) => void;
/** Video fullscreen change callback */
onFullscreenChange?: (event: VideoFullscreenChangeEvent) => void;
/** Video waiting callback */
onWaiting?: (event: TaroEvent) => void;
/** Video error callback */
onError?: (event: VideoErrorEvent) => void;
/** Video progress callback */
onProgress?: (event: VideoProgressEvent) => void;
}Audio player component for audio content playback.
/**
* Audio player component
* @supported all platforms
*/
const Audio: ComponentType<AudioProps>;
interface AudioProps extends StandardProps {
/** Audio ID for referencing
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
id?: string;
/** Audio source URL
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid
*/
src?: string;
/** Whether to loop playback
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid
* @default false
*/
loop?: boolean;
/** Whether controls are shown
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
* @default false
*/
controls?: boolean;
/** Poster image URL
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
poster?: string;
/** Audio name
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
name?: string;
/** Audio author
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
author?: string;
/** Audio error callback */
onError?: (event: AudioErrorEvent) => void;
/** Audio play callback */
onPlay?: (event: TaroEvent) => void;
/** Audio pause callback */
onPause?: (event: TaroEvent) => void;
/** Audio time update callback */
onTimeUpdate?: (event: AudioTimeUpdateEvent) => void;
/** Audio end callback */
onEnded?: (event: TaroEvent) => void;
}Camera capture component for photo and video recording.
/**
* Camera capture component
* @supported weapp, alipay, swan, tt, qq, jd, rn
*/
const Camera: ComponentType<CameraProps>;
interface CameraProps extends StandardProps {
/** Camera mode
* @supported weapp, alipay, swan, tt, qq, jd, rn
* @default "normal"
*/
mode?: 'normal' | 'scanCode';
/** Resolution mode
* @supported weapp, tt, qq, jd
* @default "medium"
*/
resolution?: 'low' | 'medium' | 'high';
/** Camera facing direction
* @supported weapp, alipay, swan, tt, qq, jd, rn
* @default "back"
*/
devicePosition?: 'front' | 'back';
/** Whether flash is enabled
* @supported weapp, alipay, swan, tt, qq, jd, rn
* @default "auto"
*/
flash?: 'auto' | 'on' | 'off' | 'torch';
/** Frame size for scan mode
* @supported weapp, tt, qq, jd
* @default "medium"
*/
frameSize?: 'small' | 'medium' | 'large';
/** Camera ready callback */
onReady?: (event: TaroEvent) => void;
/** Camera stop callback */
onStop?: (event: TaroEvent) => void;
/** Camera error callback */
onError?: (event: CameraErrorEvent) => void;
/** Scan code callback */
onScanCode?: (event: CameraScanCodeEvent) => void;
}Components for live video streaming functionality.
/**
* Live video player component
* @supported weapp, alipay, swan, tt, qq, jd
*/
const LivePlayer: ComponentType<LivePlayerProps>;
interface LivePlayerProps extends StandardProps {
/** Live stream source URL
* @supported weapp, alipay, swan, tt, qq, jd
*/
src?: string;
/** Play mode
* @supported weapp, alipay, swan, tt, qq, jd
* @default "live"
*/
mode?: 'live' | 'RTC';
/** Whether autoplay is enabled
* @supported weapp, alipay, swan, tt, qq, jd
* @default false
*/
autoplay?: boolean;
/** Whether mute is enabled
* @supported weapp, alipay, swan, tt, qq, jd
* @default false
*/
muted?: boolean;
/** Orientation mode
* @supported weapp, alipay, swan, tt, qq, jd
* @default "vertical"
*/
orientation?: 'vertical' | 'horizontal';
/** Object fit mode
* @supported weapp, alipay, swan, tt, qq, jd
* @default "contain"
*/
objectFit?: 'contain' | 'fillCrop';
/** Background mute policy
* @supported weapp, tt, qq, jd
* @default 1
*/
backgroundMute?: number;
/** Minimum cache time in seconds
* @supported weapp, tt, qq, jd
* @default 1
*/
minCache?: number;
/** Maximum cache time in seconds
* @supported weapp, tt, qq, jd
* @default 3
*/
minCache?: number;
/** Sound mode
* @supported weapp, tt, qq, jd
* @default "speaker"
*/
soundMode?: 'speaker' | 'ear';
/** Auto pause when navigate back
* @supported weapp, tt, qq, jd
* @default true
*/
autoPauseIfNavigate?: boolean;
/** Auto pause when open native app
* @supported weapp, tt, qq, jd
* @default true
*/
autoPauseIfOpenNative?: boolean;
/** Player state change callback */
onStateChange?: (event: LivePlayerStateChangeEvent) => void;
/** Full screen change callback */
onFullScreenChange?: (event: LivePlayerFullScreenChangeEvent) => void;
/** Net status callback */
onNetStatus?: (event: LivePlayerNetStatusEvent) => void;
/** Audio volume notify callback */
onAudioVolumeNotify?: (event: LivePlayerAudioVolumeNotifyEvent) => void;
}
/**
* Live video streaming component
* @supported weapp, alipay, swan, tt, qq, jd
*/
const LivePusher: ComponentType<LivePusherProps>;
interface LivePusherProps extends StandardProps {
/** Stream push URL
* @supported weapp, alipay, swan, tt, qq, jd
*/
url?: string;
/** Push mode
* @supported weapp, alipay, swan, tt, qq, jd
* @default "RTC"
*/
mode?: 'SD' | 'HD' | 'FHD' | 'RTC';
/** Whether autopush is enabled
* @supported weapp, alipay, swan, tt, qq, jd
* @default false
*/
autopush?: boolean;
/** Whether mute is enabled
* @supported weapp, alipay, swan, tt, qq, jd
* @default false
*/
muted?: boolean;
/** Whether to enable camera
* @supported weapp, alipay, swan, tt, qq, jd
* @default true
*/
enableCamera?: boolean;
/** Whether to auto focus
* @supported weapp, alipay, swan, tt, qq, jd
* @default true
*/
autoFocus?: boolean;
/** Orientation
* @supported weapp, alipay, swan, tt, qq, jd
* @default "vertical"
*/
orientation?: 'vertical' | 'horizontal';
/** Beauty filter level
* @supported weapp, alipay, swan, tt, qq, jd
* @default 0
*/
beauty?: number;
/** Whiteness filter level
* @supported weapp, alipay, swan, tt, qq, jd
* @default 0
*/
whiteness?: number;
/** Video aspect ratio
* @supported weapp, alipay, swan, tt, qq, jd
* @default "9:16"
*/
aspect?: '9:16' | '3:4';
/** Minimum bit rate
* @supported weapp, tt, qq, jd
* @default 200
*/
minBitrate?: number;
/** Maximum bit rate
* @supported weapp, tt, qq, jd
* @default 1000
*/
maxBitrate?: number;
/** Audio quality
* @supported weapp, tt, qq, jd
* @default "high"
*/
audioQuality?: 'high' | 'low';
/** Waiting image URL
* @supported weapp, tt, qq, jd
*/
waitingImage?: string;
/** Waiting image hash
* @supported weapp, tt, qq, jd
*/
waitingImageHash?: string;
/** Zoom level
* @supported weapp, tt, qq, jd
* @default 0
*/
zoom?: number;
/** Camera device position
* @supported weapp, alipay, swan, tt, qq, jd
* @default "front"
*/
devicePosition?: 'front' | 'back';
/** Background mute
* @supported weapp, tt, qq, jd
* @default false
*/
backgroundMute?: boolean;
/** Mirror mode
* @supported weapp, tt, qq, jd
* @default "auto"
*/
mirror?: 'auto' | 'enable' | 'disable';
/** State change callback */
onStateChange?: (event: LivePusherStateChangeEvent) => void;
/** Net status callback */
onNetStatus?: (event: LivePusherNetStatusEvent) => void;
/** Error callback */
onError?: (event: LivePusherErrorEvent) => void;
/** Background push callback */
onBgmStart?: (event: TaroEvent) => void;
/** Background music progress callback */
onBgmProgress?: (event: LivePusherBgmProgressEvent) => void;
/** Background music complete callback */
onBgmComplete?: (event: TaroEvent) => void;
/** Audio volume notify callback */
onAudioVolumeNotify?: (event: LivePusherAudioVolumeNotifyEvent) => void;
}Components for animated content and special effects.
/**
* Lottie animation player
* @supported weapp, tt, qq, jd, h5, rn
*/
const Lottie: ComponentType<LottieProps>;
interface LottieProps extends StandardProps {
/** Animation source path or URL
* @supported weapp, tt, qq, jd, h5, rn
*/
path?: string;
/** Animation speed multiplier
* @supported weapp, tt, qq, jd, h5, rn
* @default 1
*/
speed?: number;
/** Whether animation is looped
* @supported weapp, tt, qq, jd, h5, rn
* @default true
*/
loop?: boolean;
/** Whether autoplay is enabled
* @supported weapp, tt, qq, jd, h5, rn
* @default true
*/
autoplay?: boolean;
/** Animation action
* @supported weapp, tt, qq, jd, h5, rn
* @default "play"
*/
action?: 'play' | 'pause' | 'stop';
/** Whether animation is hidden when stopped
* @supported weapp, tt, qq, jd, h5, rn
* @default true
*/
hidden?: boolean;
/** Animation data ready callback */
onDataReady?: (event: TaroEvent) => void;
/** Animation data load failed callback */
onDataFailed?: (event: TaroEvent) => void;
/** Animation data load callback */
onAnimationStart?: (event: TaroEvent) => void;
/** Animation end callback */
onAnimationEnd?: (event: TaroEvent) => void;
}
/**
* Animated video component
* @supported weapp, tt, qq, jd
*/
const AnimationVideo: ComponentType<AnimationVideoProps>;
interface AnimationVideoProps extends StandardProps {
/** Animation video source
* @supported weapp, tt, qq, jd
*/
src?: string;
/** Whether to loop animation
* @supported weapp, tt, qq, jd
* @default false
*/
loop?: boolean;
/** Whether autoplay is enabled
* @supported weapp, tt, qq, jd
* @default false
*/
autoplay?: boolean;
/** Animation action
* @supported weapp, tt, qq, jd
* @default "play"
*/
action?: 'play' | 'pause' | 'stop';
/** Whether animation is hidden when stopped
* @supported weapp, tt, qq, jd
* @default true
*/
hidden?: boolean;
}Extended media components for specialized video and communication features.
/**
* AR camera component
* @supported weapp, tt, qq, jd
*/
const ArCamera: ComponentType<ArCameraProps>;
interface ArCameraProps extends StandardProps {
/** AR camera key
* @supported weapp, tt, qq, jd
*/
key?: string;
/** AR camera mode
* @supported weapp, tt, qq, jd
* @default "normal"
*/
mode?: 'normal' | 'AR';
/** AR camera ready callback */
onReady?: (event: TaroEvent) => void;
/** AR scan callback */
onScan?: (event: ArCameraScanEvent) => void;
/** AR camera error callback */
onError?: (event: ArCameraErrorEvent) => void;
}
/**
* Live channel component
* @supported weapp, tt, qq, jd
*/
const ChannelLive: ComponentType<ChannelLiveProps>;
interface ChannelLiveProps extends StandardProps {
/** Channel ID
* @supported weapp, tt, qq, jd
*/
channelId?: string;
/** Channel live load callback */
onLoad?: (event: ChannelLiveLoadEvent) => void;
/** Channel live error callback */
onError?: (event: ChannelLiveErrorEvent) => void;
}
/**
* Video channel component
* @supported weapp, tt, qq, jd
*/
const ChannelVideo: ComponentType<ChannelVideoProps>;
interface ChannelVideoProps extends StandardProps {
/** Channel video ID
* @supported weapp, tt, qq, jd
*/
videoId?: string;
/** Channel video load callback */
onLoad?: (event: ChannelVideoLoadEvent) => void;
/** Channel video error callback */
onError?: (event: ChannelVideoErrorEvent) => void;
}
/**
* VoIP room component
* @supported weapp, tt, qq, jd
*/
const VoipRoom: ComponentType<VoipRoomProps>;
interface VoipRoomProps extends StandardProps {
/** Room ID
* @supported weapp, tt, qq, jd
*/
roomId?: string;
/** Open type
* @supported weapp, tt, qq, jd
*/
openType?: 'voice' | 'video';
/** VoIP room join callback */
onJoin?: (event: VoipRoomJoinEvent) => void;
/** VoIP room leave callback */
onLeave?: (event: VoipRoomLeaveEvent) => void;
/** VoIP room error callback */
onError?: (event: VoipRoomErrorEvent) => void;
}
/**
* Real-time communication room
* @supported weapp, tt, qq, jd
*/
const RtcRoom: ComponentType<RtcRoomProps>;
interface RtcRoomProps extends StandardProps {
/** RTC room ID
* @supported weapp, tt, qq, jd
*/
roomId?: string;
/** RTC room join callback */
onJoin?: (event: RtcRoomJoinEvent) => void;
/** RTC room leave callback */
onLeave?: (event: RtcRoomLeaveEvent) => void;
/** RTC room error callback */
onError?: (event: RtcRoomErrorEvent) => void;
}
/**
* RTC room participant item
* @supported weapp, tt, qq, jd
*/
const RtcRoomItem: ComponentType<RtcRoomItemProps>;
interface RtcRoomItemProps extends StandardProps {
/** Participant user ID
* @supported weapp, tt, qq, jd
*/
userId?: string;
/** Stream type
* @supported weapp, tt, qq, jd
*/
streamType?: 'main' | 'aux';
}// AR Camera event interfaces
interface ArCameraScanEvent extends TaroEvent {
detail: {
result: string;
type: string;
};
}
interface ArCameraErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
// Channel event interfaces
interface ChannelLiveLoadEvent extends TaroEvent {
detail: {
// Channel live load details
};
}
interface ChannelLiveErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
interface ChannelVideoLoadEvent extends TaroEvent {
detail: {
// Channel video load details
};
}
interface ChannelVideoErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
// VoIP and RTC event interfaces
interface VoipRoomJoinEvent extends TaroEvent {
detail: {
// Join event details
};
}
interface VoipRoomLeaveEvent extends TaroEvent {
detail: {
// Leave event details
};
}
interface VoipRoomErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
interface RtcRoomJoinEvent extends TaroEvent {
detail: {
// RTC join event details
};
}
interface RtcRoomLeaveEvent extends TaroEvent {
detail: {
// RTC leave event details
};
}
interface RtcRoomErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}// Image event interfaces
interface ImageLoadEvent extends TaroEvent {
detail: {
height: number;
width: number;
};
}
interface ImageErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
// Video event interfaces
interface VideoLoadedMetadataEvent extends TaroEvent {
detail: {
width: number;
height: number;
duration: number;
};
}
interface VideoTimeUpdateEvent extends TaroEvent {
detail: {
currentTime: number;
duration: number;
};
}
interface VideoFullscreenChangeEvent extends TaroEvent {
detail: {
fullScreen: boolean;
direction: 'vertical' | 'horizontal';
};
}
interface VideoErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
interface VideoProgressEvent extends TaroEvent {
detail: {
buffered: number;
};
}
// Audio event interfaces
interface AudioErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
interface AudioTimeUpdateEvent extends TaroEvent {
detail: {
currentTime: number;
duration: number;
};
}
// Camera event interfaces
interface CameraErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
interface CameraScanCodeEvent extends TaroEvent {
detail: {
result: string;
};
}
// Live streaming event interfaces
interface LivePlayerStateChangeEvent extends TaroEvent {
detail: {
code: number;
};
}
interface LivePlayerFullScreenChangeEvent extends TaroEvent {
detail: {
direction: 'vertical' | 'horizontal';
fullScreen: boolean;
};
}
interface LivePlayerNetStatusEvent extends TaroEvent {
detail: {
info: Record<string, any>;
};
}
interface LivePlayerAudioVolumeNotifyEvent extends TaroEvent {
detail: {
volume: number;
};
}
interface LivePusherStateChangeEvent extends TaroEvent {
detail: {
code: number;
};
}
interface LivePusherNetStatusEvent extends TaroEvent {
detail: {
info: Record<string, any>;
};
}
interface LivePusherErrorEvent extends TaroEvent {
detail: {
errMsg: string;
errCode: number;
};
}
interface LivePusherBgmProgressEvent extends TaroEvent {
detail: {
progress: number;
duration: number;
};
}
interface LivePusherAudioVolumeNotifyEvent extends TaroEvent {
detail: {
volume: number;
};
}Install with Tessl CLI
npx tessl i tessl/npm-tarojs--components