# Line 直线绘制组件。 > **说明:** > > 该组件从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 ## 权限列表 无 ## 子组件 无 ## 接口 Line(value?: {width: string | number, height: string | number}) **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | ------ | -------------------------- | ---- | ------ | -------- | | width | string \| number | 是 | - | 宽度。 | | height | string \| number | 是 | - | 高度。 | ## 属性 | 参数名称 | 参数类型 | 默认值 | 必填 | 参数描述 | | ---------- | ------------- | ----------- | ---- | ------------------------ | | width | [Length](ts-types.md#length) | 0 | 否 | 直线所在矩形的宽度。 | | height | [Length](ts-types.md#length) | 0 | 否 | 直线所在矩形的高度。 | | startPoint | Array<Point> | [0, 0] | 是 | 直线起点坐标(相对坐标)。 | | endPoint | Array<Point> | [0, 0] | 是 | 直线终点坐标(相对坐标)。 | ## Point | 名称 | 类型定义 | 描述 | | ----- | --------------------- | ---------------------------------------------------- | | Point | [[Length](ts-types.md#length), [Length](ts-types.md#length)] | 用于描述点坐标,第一个值为x轴坐标,第二个值为y坐标。 | ## 示例 ```ts // xxx.ets @Entry @Component struct LineExample { build() { Column() { Line({ width: 50, height: 100 }).startPoint([0, 0]).endPoint([50, 100]) Line().width(200).height(200).startPoint([50, 50]).endPoint([150, 150]) }.margin({ top: 5 }) } } ``` ![zh-cn_image_0000001219982725](figures/zh-cn_image_0000001219982725.jpg)