ArkUI preview supports page preview, component preview, multi-breakpoint preview, and widget preview. As shown in the figure below, the left icon
corresponds to page preview, the middle icon
corresponds to component preview, and the right icon
corresponds to multi-breakpoint preview. Widget preview can be enabled directly after a widget file is created.

ArkTS apps/atomic services support page preview. To use this feature, add the @Entry decorator at the top of the project's .ets file.
The following exemplifies how to use the @Entry decorator:
@Entry
@Component
struct Index {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
} ArkTS apps/atomic services support component preview. Component preview supports real-time preview, but not dynamic pictures or dynamic preview. Before previewing a component, you must decorate it with the @Preview decorator. In a single source file, you can use up to 10 @Preview decorators to decorate custom components.
@Preview({
title: 'ContentTable'
})
@Component
struct ContentTablePreview {
build() {
Flex() {
ContentTable({ foodItem: getDefaultFoodData() })
}
}
} Below is a preview of the component.

@Preview({
title: 'Component1', // Name of the component to preview.
deviceType: 'phone', // Type of the device for rendering and previewing the component. The default value is phone.
width: 1080, // Width of the preview device, in pixels.
height: 2340, // Height of the preview device, in px.
colorMode: 'light', // Color mode of the preview device. The value can only be light.
dpi: 480, // Screen DPI value of the preview device.
locale: 'zh_CN', // Language of the preview device, for example, zh_CN or en_US.
orientation: 'portrait', // Screen orientation of the preview device. The value can be portrait or landscape.
roundScreen: false // Whether the screen shape of the preview device is round.
}) If the component you want to preview depends on parameter injection, add the @Preview decorator as follows: Define a component fragment, declare in the fragment the component to be previewed and parameter dependency, and add the @Preview decorator to the component fragment. For example, to preview the component below:
@Component
struct Title {
@Prop context: string;
build() {
Text(this.context)
}
} Add @Preview as follows:
@Preview
@Component // Define the component fragment TitlePreview.
struct TitlePreview {
build() {
Title({ context: 'MyTitle' }) // Declare the component to preview, Title in this case, and the parameter {context: 'MyTitle'} on which the component depends.
}
} Since version 26.0.0, multi-breakpoint preview is available for ArkTS apps and atomic services, enabling simultaneous display of preview views for eight typical breakpoints. Real-time preview and quick preview are not supported in multi-breakpoint preview mode. If images are excessively large or numerous, they may fail to be displayed during preview.
Multi-breakpoint preview is implemented by adding the @Entry decorator at the top of the .ets file of your project. The sample code is as follows:
@Entry
@Component
struct Index {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
} The multi-breakpoint preview effect of the preceding sample is shown in the figure below, which displays preview results under eight typical breakpoints.

You can click
on each preview view to check the component tree for that breakpoint.
