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.
—
Components for integrating with platform-specific features including advertisements, payment systems, maps, canvas, and web views.
Interactive map component with markers, overlays, and location services.
/**
* Map display component with markers and overlays
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
const Map: ComponentType<MapProps>;
interface MapProps extends StandardProps {
/** Map center longitude
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
longitude?: number;
/** Map center latitude
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
latitude?: number;
/** Map scale level
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
* @default 16
*/
scale?: number;
/** Map markers array
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
markers?: MapMarker[];
/** Map polylines array
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
polyline?: MapPolyline[];
/** Map circles array
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
circles?: MapCircle[];
/** Map controls array
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
controls?: MapControl[];
/** Map polygons array
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
polygons?: MapPolygon[];
/** Whether to include POI points
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
* @default false
*/
includePoints?: MapIncludePoint[];
/** Whether to show location
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
* @default false
*/
showLocation?: boolean;
/** Map layer style
* @supported weapp, tt, qq, jd
* @default 1
*/
layerStyle?: number;
/** Whether to enable 3D
* @supported weapp, tt, qq, jd
* @default false
*/
enable3D?: boolean;
/** Whether to show compass
* @supported weapp, tt, qq, jd
* @default false
*/
showCompass?: boolean;
/** Whether to enable overview map
* @supported weapp, tt, qq, jd
* @default false
*/
enableOverlooking?: boolean;
/** Whether to enable rotation
* @supported weapp, tt, qq, jd
* @default false
*/
enableRotating?: boolean;
/** Whether to enable scroll
* @supported weapp, tt, qq, jd
* @default true
*/
enableScrolling?: boolean;
/** Whether to enable zoom
* @supported weapp, tt, qq, jd
* @default true
*/
enableZoom?: boolean;
/** Whether to enable POI click
* @supported weapp, tt, qq, jd
* @default false
*/
enablePoi?: boolean;
/** Whether to enable building display
* @supported weapp, tt, qq, jd
* @default false
*/
enableBuilding?: boolean;
/** Map tap callback */
onTap?: (event: MapTapEvent) => void;
/** Marker tap callback */
onMarkerTap?: (event: MapMarkerTapEvent) => void;
/** Label tap callback */
onLabelTap?: (event: MapLabelTapEvent) => void;
/** Control tap callback */
onControlTap?: (event: MapControlTapEvent) => void;
/** Callout tap callback */
onCalloutTap?: (event: MapCalloutTapEvent) => void;
/** Map region change callback */
onRegionChange?: (event: MapRegionChangeEvent) => void;
/** POI tap callback */
onPoiTap?: (event: MapPoiTapEvent) => void;
/** Map error callback */
onError?: (event: MapErrorEvent) => void;
}HTML5 Canvas drawing component for custom graphics and animations.
/**
* HTML5 Canvas drawing component
* @supported all platforms
*/
const Canvas: ComponentType<CanvasProps>;
interface CanvasProps extends StandardProps {
/** Canvas type
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
* @default "2d"
*/
type?: '2d' | 'webgl';
/** Canvas ID for referencing
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
canvasId?: string;
/** Whether to disable scroll
* @supported weapp, alipay, swan, tt, qq, jd, h5
* @default false
*/
disableScroll?: boolean;
/** Canvas touch start callback */
onTouchStart?: (event: CanvasTouchEvent) => void;
/** Canvas touch move callback */
onTouchMove?: (event: CanvasTouchEvent) => void;
/** Canvas touch end callback */
onTouchEnd?: (event: CanvasTouchEvent) => void;
/** Canvas touch cancel callback */
onTouchCancel?: (event: CanvasTouchEvent) => void;
/** Canvas long tap callback */
onLongTap?: (event: CanvasTouchEvent) => void;
/** Canvas error callback */
onError?: (event: CanvasErrorEvent) => void;
}Web view container for embedding external web content.
/**
* Web view container for external content
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid
*/
const WebView: ComponentType<WebViewProps>;
interface WebViewProps extends StandardProps {
/** Web page URL to load
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony_hybrid
*/
src?: string;
/** Progressive web app flag
* @supported weapp, tt, qq, jd
* @default false
*/
progressBarColor?: string;
/** Web view load callback */
onLoad?: (event: WebViewLoadEvent) => void;
/** Web view error callback */
onError?: (event: WebViewErrorEvent) => void;
/** Web view message callback */
onMessage?: (event: WebViewMessageEvent) => void;
}Components for displaying various types of advertisements.
/**
* Advertisement display component
* @supported weapp, alipay, swan, tt, qq, jd
*/
const Ad: ComponentType<AdProps>;
interface AdProps extends StandardProps {
/** Ad unit ID
* @supported weapp, alipay, swan, tt, qq, jd
*/
unitId?: string;
/** Ad type
* @supported weapp, tt, qq, jd
* @default "banner"
*/
adType?: 'banner' | 'video' | 'grid' | 'large';
/** Ad intervals array
* @supported weapp, tt, qq, jd
*/
adIntervals?: number;
/** Ad theme
* @supported weapp, tt, qq, jd
* @default "white"
*/
adTheme?: 'white' | 'black';
/** Ad load callback */
onLoad?: (event: AdLoadEvent) => void;
/** Ad error callback */
onError?: (event: AdErrorEvent) => void;
/** Ad close callback */
onClose?: (event: AdCloseEvent) => void;
}
/**
* Custom advertisement component
* @supported weapp, tt, qq, jd
*/
const AdCustom: ComponentType<AdCustomProps>;
interface AdCustomProps extends StandardProps {
/** Ad unit ID
* @supported weapp, tt, qq, jd
*/
unitId?: string;
/** Ad intervals
* @supported weapp, tt, qq, jd
*/
adIntervals?: number;
/** Ad load callback */
onLoad?: (event: AdLoadEvent) => void;
/** Ad error callback */
onError?: (event: AdErrorEvent) => void;
}
/**
* Aweme data component
* @supported weapp, tt, qq, jd
*/
const AwemeData: ComponentType<AwemeDataProps>;
interface AwemeDataProps extends StandardProps {
/** Aweme data type
* @supported weapp, tt, qq, jd
*/
type?: string;
/** Aweme data load callback */
onLoad?: (event: AwemeDataLoadEvent) => void;
/** Aweme data error callback */
onError?: (event: AwemeDataErrorEvent) => void;
}Components for accessing platform-specific services and features.
/**
* Official account integration component
* @supported weapp
*/
const OfficialAccount: ComponentType<OfficialAccountProps>;
interface OfficialAccountProps extends StandardProps {
/** Official account load callback */
onLoad?: (event: TaroEvent) => void;
/** Official account error callback */
onError?: (event: OfficialAccountErrorEvent) => void;
}
/**
* Open data access component
* @supported weapp, tt, qq, jd
*/
const OpenData: ComponentType<OpenDataProps>;
interface OpenDataProps extends StandardProps {
/** Open data type
* @supported weapp, tt, qq, jd
*/
type?: 'groupName' | 'userNickName' | 'userAvatarUrl' | 'userGender' | 'userCity' | 'userProvince' | 'userCountry' | 'userLanguage';
/** Open group ID
* @supported weapp, tt, qq, jd
*/
openGid?: string;
/** Default text
* @supported weapp, tt, qq, jd
*/
defaultText?: string;
/** Default avatar
* @supported weapp, tt, qq, jd
*/
defaultAvatar?: string;
/** Open data error callback */
onError?: (event: OpenDataErrorEvent) => void;
}
/**
* Login interface component
* @supported weapp, alipay, swan, tt, qq, jd
*/
const Login: ComponentType<LoginProps>;
interface LoginProps extends StandardProps {
/** Login success callback */
onSuccess?: (event: LoginSuccessEvent) => void;
/** Login fail callback */
onFail?: (event: LoginFailEvent) => void;
}
/**
* Baidu Smart Program follow component
* @supported swan
*/
const FollowSwan: ComponentType<FollowSwanProps>;
interface FollowSwanProps extends StandardProps {
/** Follow swan callback */
onFollow?: (event: FollowSwanEvent) => void;
/** Follow swan error callback */
onError?: (event: FollowSwanErrorEvent) => void;
}
/**
* Lifestyle service component
* @supported weapp, tt, qq, jd
*/
const Lifestyle: ComponentType<LifestyleProps>;
interface LifestyleProps extends StandardProps {
/** Lifestyle service type
* @supported weapp, tt, qq, jd
*/
type?: string;
/** Lifestyle load callback */
onLoad?: (event: LifestyleLoadEvent) => void;
/** Lifestyle error callback */
onError?: (event: LifestyleErrorEvent) => void;
}
/**
* Inline payment interface component
* @supported weapp, tt, qq, jd
*/
const InlinePaymentPanel: ComponentType<InlinePaymentPanelProps>;
interface InlinePaymentPanelProps extends StandardProps {
/** Payment request parameters
* @supported weapp, tt, qq, jd
*/
requestParameters?: Record<string, any>;
/** Payment success callback */
onPaymentSuccess?: (event: PaymentSuccessEvent) => void;
/** Payment fail callback */
onPaymentFail?: (event: PaymentFailEvent) => void;
}Components for content services and social interactions.
/**
* Comment detail display component
* @supported weapp, tt, qq, jd
*/
const CommentDetail: ComponentType<CommentDetailProps>;
interface CommentDetailProps extends StandardProps {
/** Comment ID
* @supported weapp, tt, qq, jd
*/
commentId?: string;
/** Comment load callback */
onLoad?: (event: CommentLoadEvent) => void;
/** Comment error callback */
onError?: (event: CommentErrorEvent) => void;
}
/**
* Comment list display component
* @supported weapp, tt, qq, jd
*/
const CommentList: ComponentType<CommentListProps>;
interface CommentListProps extends StandardProps {
/** Content ID
* @supported weapp, tt, qq, jd
*/
contentId?: string;
/** Comment list load callback */
onLoad?: (event: CommentListLoadEvent) => void;
/** Comment list error callback */
onError?: (event: CommentListErrorEvent) => void;
}
/**
* Like interaction component
* @supported weapp, tt, qq, jd
*/
const Like: ComponentType<LikeProps>;
interface LikeProps extends StandardProps {
/** Content ID to like
* @supported weapp, tt, qq, jd
*/
contentId?: string;
/** Like status change callback */
onChange?: (event: LikeChangeEvent) => void;
/** Like error callback */
onError?: (event: LikeErrorEvent) => void;
}
/**
* Customer service contact button
* @supported weapp, alipay, swan, tt, qq, jd
*/
const ContactButton: ComponentType<ContactButtonProps>;
interface ContactButtonProps extends StandardProps {
/** Contact success callback */
onContact?: (event: ContactSuccessEvent) => void;
}Components for page configuration and utility functions.
/**
* Page metadata configuration component
* @supported weapp, tt, qq, jd
*/
const PageMeta: ComponentType<PageMetaProps>;
interface PageMetaProps extends StandardProps {
/** Page background text style
* @supported weapp, tt, qq, jd
* @default "dark"
*/
backgroundTextStyle?: 'dark' | 'light';
/** Page background color
* @supported weapp, tt, qq, jd
* @default "#ffffff"
*/
backgroundColor?: string;
/** Page background color top
* @supported weapp, tt, qq, jd
* @default "#ffffff"
*/
backgroundColorTop?: string;
/** Page background color bottom
* @supported weapp, tt, qq, jd
* @default "#ffffff"
*/
backgroundColorBottom?: string;
/** Page scroll flag
* @supported weapp, tt, qq, jd
* @default false
*/
enablePullDownRefresh?: boolean;
/** Page orientation
* @supported weapp, tt, qq, jd
* @default "portrait"
*/
pageOrientation?: 'auto' | 'portrait' | 'landscape';
/** Page scroll callback */
onScroll?: (event: PageMetaScrollEvent) => void;
/** Page resize callback */
onResize?: (event: PageMetaResizeEvent) => void;
}
/**
* Custom wrapper component
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
const CustomWrapper: ComponentType<CustomWrapperProps>;
interface CustomWrapperProps extends StandardProps {
// Custom wrapper properties
}
/**
* Content slot component
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
const Slot: ComponentType<SlotProps>;
interface SlotProps extends StandardProps {
/** Slot name
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
*/
name?: string;
}
/**
* Native slot component
* @supported weapp, tt, qq, jd
*/
const NativeSlot: ComponentType<NativeSlotProps>;
interface NativeSlotProps extends StandardProps {
/** Native slot name
* @supported weapp, tt, qq, jd
*/
name?: string;
}
/**
* Script execution component
* @supported weapp, tt, qq, jd, h5
*/
const Script: ComponentType<ScriptProps>;
interface ScriptProps extends StandardProps {
/** Script source URL
* @supported weapp, tt, qq, jd, h5
*/
src?: string;
/** Script load callback */
onLoad?: (event: TaroEvent) => void;
/** Script error callback */
onError?: (event: ScriptErrorEvent) => void;
}
/**
* Pull-to-refresh interaction component
* @supported weapp, tt, qq, jd, h5
*/
const PullToRefresh: ComponentType<PullToRefreshProps>;
interface PullToRefreshProps extends StandardProps {
/** Refresh callback */
onRefresh?: (event: TaroEvent) => void;
}// Map related interfaces
interface MapMarker {
id: number;
latitude: number;
longitude: number;
title?: string;
iconPath?: string;
rotate?: number;
alpha?: number;
width?: number;
height?: number;
anchor?: { x: number; y: number };
callout?: MapCallout;
label?: MapLabel;
}
interface MapPolyline {
points: Array<{ latitude: number; longitude: number }>;
color?: string;
width?: number;
dottedLine?: boolean;
arrowLine?: boolean;
arrowIconPath?: string;
borderColor?: string;
borderWidth?: number;
}
interface MapCircle {
latitude: number;
longitude: number;
color?: string;
fillColor?: string;
radius: number;
strokeWidth?: number;
}
interface MapControl {
id?: number;
position: { left: number; top: number; width?: number; height?: number };
iconPath: string;
clickable?: boolean;
}
interface MapPolygon {
points: Array<{ latitude: number; longitude: number }>;
strokeWidth?: number;
strokeColor?: string;
fillColor?: string;
zIndex?: number;
}
interface MapIncludePoint {
latitude: number;
longitude: number;
padding?: number[];
}
interface MapCallout {
content: string;
color?: string;
fontSize?: number;
borderRadius?: number;
bgColor?: string;
padding?: number;
display?: 'BYCLICK' | 'ALWAYS';
textAlign?: 'left' | 'right' | 'center';
}
interface MapLabel {
content: string;
color?: string;
fontSize?: number;
x?: number;
y?: number;
anchorX?: number;
anchorY?: number;
borderWidth?: number;
borderColor?: string;
borderRadius?: number;
bgColor?: string;
padding?: number;
textAlign?: 'left' | 'right' | 'center';
}
// Map event interfaces
interface MapTapEvent extends TaroEvent {
detail: {
latitude: number;
longitude: number;
};
}
interface MapMarkerTapEvent extends TaroEvent {
detail: {
markerId: number;
latitude: number;
longitude: number;
};
}
interface MapLabelTapEvent extends TaroEvent {
detail: {
markerId: number;
};
}
interface MapControlTapEvent extends TaroEvent {
detail: {
controlId: number;
};
}
interface MapCalloutTapEvent extends TaroEvent {
detail: {
markerId: number;
};
}
interface MapRegionChangeEvent extends TaroEvent {
detail: {
type: 'begin' | 'end';
causedBy: 'scale' | 'drag' | 'update';
region: {
latitude: number;
longitude: number;
latitudeDelta: number;
longitudeDelta: number;
};
};
}
interface MapPoiTapEvent extends TaroEvent {
detail: {
name: string;
latitude: number;
longitude: number;
};
}
interface MapErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
// Canvas event interfaces
interface CanvasTouchEvent extends TaroEvent {
detail: {
x: number;
y: number;
};
}
interface CanvasErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
// WebView event interfaces
interface WebViewLoadEvent extends TaroEvent {
detail: {
src: string;
};
}
interface WebViewErrorEvent extends TaroEvent {
detail: {
src: string;
errMsg: string;
};
}
interface WebViewMessageEvent extends TaroEvent {
detail: {
data: any[];
};
}
// Advertisement event interfaces
interface AdLoadEvent extends TaroEvent {
detail: {
height: number;
};
}
interface AdErrorEvent extends TaroEvent {
detail: {
errMsg: string;
errCode: number;
};
}
interface AdCloseEvent extends TaroEvent {
detail: {
// Close event details
};
}
// Aweme data event interfaces
interface AwemeDataLoadEvent extends TaroEvent {
detail: {
// Aweme data load details
};
}
interface AwemeDataErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
// Platform service event interfaces
interface OfficialAccountErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
interface OpenDataErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
interface LoginSuccessEvent extends TaroEvent {
detail: {
code: string;
};
}
interface LoginFailEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
interface PaymentSuccessEvent extends TaroEvent {
detail: {
// Payment success details
};
}
interface PaymentFailEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
// Follow Swan event interfaces
interface FollowSwanEvent extends TaroEvent {
detail: {
// Follow event details
};
}
interface FollowSwanErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
// Lifestyle event interfaces
interface LifestyleLoadEvent extends TaroEvent {
detail: {
// Lifestyle load details
};
}
interface LifestyleErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
// Content service event interfaces
interface CommentLoadEvent extends TaroEvent {
detail: {
// Comment load details
};
}
interface CommentErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
interface CommentListLoadEvent extends TaroEvent {
detail: {
// Comment list details
};
}
interface CommentListErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
interface LikeChangeEvent extends TaroEvent {
detail: {
liked: boolean;
};
}
interface LikeErrorEvent extends TaroEvent {
detail: {
errMsg: string;
};
}
interface ContactSuccessEvent extends TaroEvent {
detail: {
// Contact details
};
}
// Page configuration event interfaces
interface PageMetaScrollEvent extends TaroEvent {
detail: {
scrollTop: number;
};
}
interface PageMetaResizeEvent extends TaroEvent {
detail: {
size: {
windowWidth: number;
windowHeight: number;
};
};
}
interface ScriptErrorEvent extends TaroEvent {
detail: {
src: string;
errMsg: string;
};
}Install with Tessl CLI
npx tessl i tessl/npm-tarojs--components