BorderProperty

Description of View's border

Create from source

func NewBorder(params Params) BorderProperty

Creates new border property and returns its interface

Create from resource

View {
    border = _{
        style = solid,
        width = 1px,
        color = #FF0433FF,
    },
}
GridLayout {
    width = 100%,
    height = 100%,
    cell-horizontal-align = center,
    cell-vertical-align = center,
    content = TextView {
        text = "Some text",
        padding = 0.5em,
        border = _{
            color = "black, black, blue, blue",
            style = "dotted, solid, solid, dotted",
            width = 1px
        },
    },
}

Interface description

Inherit methods from Properties, fmt.Stringer

ViewBorders(session Session) ViewBorders

Returns top, right, bottom and left borders information all together

Properties

"bottom-color"

Bottom border line color

Constant: BottomColor

Types: Color, string

Internal type is Color, other types converted to it during assignment

See Color description for more details

Examples

GridLayout {
    width = 100%,
    height = 100%,
    cell-horizontal-align = center,
    cell-vertical-align = center,
    content = TextView {
        text = "Some text",
        border = _{
            color = "white, white, red, white",
            style = "none, none, solid, none",
            width = 2px
        },
    },
}
view := rui.NewGridLayout(session, rui.Params{
    rui.Width:               rui.Percent(100),
    rui.Height:              rui.Percent(100),
    rui.CellHorizontalAlign: rui.CenterAlign,
    rui.CellVerticalAlign:   rui.CenterAlign,
    rui.Content: rui.NewTextView(session, rui.Params{
        rui.Text: "Some text",
        rui.Border: rui.NewBorder(rui.Params{
            rui.BottomColor: rui.Red,
            rui.BottomStyle: rui.SolidLine,
            rui.BottomWidth: rui.Px(2),
        }),
    }),
})

"bottom-style"

Bottom border line style

Constant: BottomStyle

Types: int, string

Values

int string Description
0(NoneLine) "none" The border will not be drawn
1(SolidLine) "solid" Solid line as a border
2(DashedLine) "dashed" Dashed line as a border
3(DottedLine) "dotted" Dotted line as a border
4(DoubleLine) "double" Double line as a border

"bottom-width"

Bottom border line width

Constant: BottomWidth

Types: SizeUnit, SizeFunc, string, float, int

Internal type is SizeUnit, other types converted to it during assignment

See SizeUnit description for more details

Examples

GridLayout {
    width = 100%,
    height = 100%,
    cell-horizontal-align = center,
    cell-vertical-align = center,
    content = TextView {
        text = "Some text",
        border = _{
            color = "white, white, red, white",
            style = "none, none, solid, none",
            width = 2px
        },
    },
}
view := rui.NewGridLayout(session, rui.Params{
    rui.Width:               rui.Percent(100),
    rui.Height:              rui.Percent(100),
    rui.CellHorizontalAlign: rui.CenterAlign,
    rui.CellVerticalAlign:   rui.CenterAlign,
    rui.Content: rui.NewTextView(session, rui.Params{
        rui.Text: "Some text",
        rui.Border: rui.NewBorder(rui.Params{
            rui.BottomColor: rui.Red,
            rui.BottomStyle: rui.SolidLine,
            rui.BottomWidth: rui.Px(2),
        }),
    }),
})

"color"

Border line color

Constant: ColorTag

Types: Color, string

Internal type is Color, other types converted to it during assignment

See Color description for more details

Examples

GridLayout {
    width = 100%,
    height = 100%,
    cell-horizontal-align = center,
    cell-vertical-align = center,
    content = TextView {
        text = "Some text",
        border = _{
            color = "gray, gray, gray, gray",
            style = "solid, solid, solid, solid",
            width = 1px
        },
    },
}
view := rui.NewGridLayout(session, rui.Params{
    rui.Width:               rui.Percent(100),
    rui.Height:              rui.Percent(100),
    rui.CellHorizontalAlign: rui.CenterAlign,
    rui.CellVerticalAlign:   rui.CenterAlign,
    rui.Content: rui.NewTextView(session, rui.Params{
        rui.Text: "Some text",
        rui.Border: rui.NewBorder(rui.Params{
            rui.ColorTag: rui.Gray,
            rui.Style:    rui.SolidLine,
            rui.Width:    rui.Px(1),
        }),
    }),
})

"left-color"

Left border line color

Constant: LeftColor

Types: Color, string

Internal type is Color, other types converted to it during assignment

See Color description for more details

Examples

GridLayout {
    width = 100%,
    height = 100%,
    cell-horizontal-align = center,
    cell-vertical-align = center,
    content = TextView {
        text = "Some text",
        border = _{
            color = "white, white, white, red",
            style = "none, none, none, solid",
            width = 2px
        },
    },
}
view := rui.NewGridLayout(session, rui.Params{
    rui.Width:               rui.Percent(100),
    rui.Height:              rui.Percent(100),
    rui.CellHorizontalAlign: rui.CenterAlign,
    rui.CellVerticalAlign:   rui.CenterAlign,
    rui.Content: rui.NewTextView(session, rui.Params{
        rui.Text: "Some text",
        rui.Border: rui.NewBorder(rui.Params{
            rui.LeftColor: rui.Red,
            rui.LeftStyle: rui.SolidLine,
            rui.LeftWidth: rui.Px(2),
        }),
    }),
})

"left-style"

Left border line style

Constant: LeftStyle

Types: int, string

Values

int string Description
0(NoneLine) "none" The border will not be drawn
1(SolidLine) "solid" Solid line as a border
2(DashedLine) "dashed" Dashed line as a border
3(DottedLine) "dotted" Dotted line as a border
4(DoubleLine) "double" Double line as a border

"left-width"

Left border line width

Constant: LeftWidth

Types: SizeUnit, SizeFunc, string, float, int

Internal type is SizeUnit, other types converted to it during assignment

See SizeUnit description for more details

Examples

GridLayout {
    width = 100%,
    height = 100%,
    cell-horizontal-align = center,
    cell-vertical-align = center,
    content = TextView {
        text = "Some text",
        border = _{
            color = "white, white, white, red",
            style = "none, none, none, solid",
            width = 2px
        },
    },
}
view := rui.NewGridLayout(session, rui.Params{
    rui.Width:               rui.Percent(100),
    rui.Height:              rui.Percent(100),
    rui.CellHorizontalAlign: rui.CenterAlign,
    rui.CellVerticalAlign:   rui.CenterAlign,
    rui.Content: rui.NewTextView(session, rui.Params{
        rui.Text: "Some text",
        rui.Border: rui.NewBorder(rui.Params{
            rui.LeftColor: rui.Red,
            rui.LeftStyle: rui.SolidLine,
            rui.LeftWidth: rui.Px(2),
        }),
    }),
})

"right-color"

Right border line color

Constant: RightColor

Types: Color, string

Internal type is Color, other types converted to it during assignment

See Color description for more details

Examples

GridLayout {
    width = 100%,
    height = 100%,
    cell-horizontal-align = center,
    cell-vertical-align = center,
    content = TextView {
        text = "Some text",
        border = _{
            color = "white, red, white, white",
            style = "none, solid, none, none",
            width = 2px
        },
    },
}
view := rui.NewGridLayout(session, rui.Params{
    rui.Width:               rui.Percent(100),
    rui.Height:              rui.Percent(100),
    rui.CellHorizontalAlign: rui.CenterAlign,
    rui.CellVerticalAlign:   rui.CenterAlign,
    rui.Content: rui.NewTextView(session, rui.Params{
        rui.Text: "Some text",
        rui.Border: rui.NewBorder(rui.Params{
            rui.RightColor: rui.Red,
            rui.RightStyle: rui.SolidLine,
            rui.RightWidth: rui.Px(2),
        }),
    }),
})

"right-style"

Right border line style

Constant: RightStyle

Types: int, string

Values

int string Description
0(NoneLine) "none" The border will not be drawn
1(SolidLine) "solid" Solid line as a border
2(DashedLine) "dashed" Dashed line as a border
3(DottedLine) "dotted" Dotted line as a border
4(DoubleLine) "double" Double line as a border

"right-width"

Right border line width

Constant: RightWidth

Types: SizeUnit, SizeFunc, string, float, int

Internal type is SizeUnit, other types converted to it during assignment

See SizeUnit description for more details

Examples

GridLayout {
    width = 100%,
    height = 100%,
    cell-horizontal-align = center,
    cell-vertical-align = center,
    content = TextView {
        text = "Some text",
        border = _{
            color = "white, red, white, white",
            style = "none, solid, none, none",
            width = 2px
        },
    },
}
view := rui.NewGridLayout(session, rui.Params{
    rui.Width:               rui.Percent(100),
    rui.Height:              rui.Percent(100),
    rui.CellHorizontalAlign: rui.CenterAlign,
    rui.CellVerticalAlign:   rui.CenterAlign,
    rui.Content: rui.NewTextView(session, rui.Params{
        rui.Text: "Some text",
        rui.Border: rui.NewBorder(rui.Params{
            rui.RightColor: rui.Red,
            rui.RightStyle: rui.SolidLine,
            rui.RightWidth: rui.Px(2),
        }),
    }),
})

"style"

Border line style

Constant: Style

Types: int, string

Values

int string Description
0(NoneLine) "none" The border will not be drawn
1(SolidLine) "solid" Solid line as a border
2(DashedLine) "dashed" Dashed line as a border
3(DottedLine) "dotted" Dotted line as a border
4(DoubleLine) "double" Double line as a border

"top-color"

Top border line color

Constant: TopColor

Types: Color, string

Internal type is Color, other types converted to it during assignment

See Color description for more details

Examples

GridLayout {
    width = 100%,
    height = 100%,
    cell-horizontal-align = center,
    cell-vertical-align = center,
    content = TextView {
        text = "Some text",
        border = _{
            color = "red, white, white, white",
            style = "solid, none, none, none",
            width = 2px
        },
    },
}
view := rui.NewGridLayout(session, rui.Params{
    rui.Width:               rui.Percent(100),
    rui.Height:              rui.Percent(100),
    rui.CellHorizontalAlign: rui.CenterAlign,
    rui.CellVerticalAlign:   rui.CenterAlign,
    rui.Content: rui.NewTextView(session, rui.Params{
        rui.Text: "Some text",
        rui.Border: rui.NewBorder(rui.Params{
            rui.TopColor: rui.Red,
            rui.TopStyle: rui.SolidLine,
            rui.TopWidth: rui.Px(2),
        }),
    }),
})

"top-style"

Top border line style

Constant: TopStyle

Types: int, string

Values

int string Description
0(NoneLine) "none" The border will not be drawn
1(SolidLine) "solid" Solid line as a border
2(DashedLine) "dashed" Dashed line as a border
3(DottedLine) "dotted" Dotted line as a border
4(DoubleLine) "double" Double line as a border

"top-width"

Top border line width

Constant: TopWidth

Types: SizeUnit, SizeFunc, string, float, int

Internal type is SizeUnit, other types converted to it during assignment

See SizeUnit description for more details

Examples

GridLayout {
    width = 100%,
    height = 100%,
    cell-horizontal-align = center,
    cell-vertical-align = center,
    content = TextView {
        text = "Some text",
        border = _{
            color = "red, white, white, white",
            style = "solid, none, none, none",
            width = 2px
        },
    },
}
view := rui.NewGridLayout(session, rui.Params{
    rui.Width:               rui.Percent(100),
    rui.Height:              rui.Percent(100),
    rui.CellHorizontalAlign: rui.CenterAlign,
    rui.CellVerticalAlign:   rui.CenterAlign,
    rui.Content: rui.NewTextView(session, rui.Params{
        rui.Text: "Some text",
        rui.Border: rui.NewBorder(rui.Params{
            rui.TopColor: rui.Red,
            rui.TopStyle: rui.SolidLine,
            rui.TopWidth: rui.Px(2),
        }),
    }),
})

"width"

Border line width

Constant: Width

Types: SizeUnit, string

Internal type is SizeUnit, other types converted to it during assignment

See SizeUnit description for more details

Examples

GridLayout {
    width = 100%,
    height = 100%,
    cell-horizontal-align = center,
    cell-vertical-align = center,
    content = TextView {
        text = "Some text",
        border = _{
            color = "gray, gray, gray, gray",
            style = "solid, solid, solid, solid",
            width = 1px
        },
    },
}
view := rui.NewGridLayout(session, rui.Params{
    rui.Width:               rui.Percent(100),
    rui.Height:              rui.Percent(100),
    rui.CellHorizontalAlign: rui.CenterAlign,
    rui.CellVerticalAlign:   rui.CenterAlign,
    rui.Content: rui.NewTextView(session, rui.Params{
        rui.Text: "Some text",
        rui.Border: rui.NewBorder(rui.Params{
            rui.ColorTag: rui.Gray,
            rui.Style:    rui.SolidLine,
            rui.Width:    rui.Px(1),
        }),
    }),
})