Skip to content

Commit 1b7e483

Browse files
docs(common): update dimensions for string properties
1 parent d0ae1b9 commit 1b7e483

File tree

10 files changed

+39
-17
lines changed

10 files changed

+39
-17
lines changed

common-features/dimensions.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: Dimensions
3+
page_title: Dimensions
4+
description: How dimensions work and are set in the Telerik UI for Blazor component suite
5+
slug: common-features/dimensions
6+
tags: telerik,blazor,dimensions,width,height,percent,pixel
7+
published: True
8+
position: 3
9+
---
10+
11+
# Dimensions
12+
13+
This article explains how dimensional properties like `Width` and `Height`, `Top` and `Left` work in the Telerik UI for Blazor suite to set size and position.
14+
15+
Properties that denote **dimensions and positions are** simple **string properties** that are not parsed by our code. You can provide **valid CSS values** to them. For example, `100px` or `50%` are valid options. This provides you with flexibility without limiting options. At the time of writing there is no `Unit` type in the underlying framework.
16+
17+
The string you provide is usually rendered within an inline `style` attribute, so you must make sure to provide a valid value that will not break other options. You do not need to include a semicolon (`;`).
18+
19+
For elements with **special positioning** (`Top` and `Left` properties), keep in mind that if the parent elements have special CSS positioning, it will affect the position of the component. If you experience issues, inspect the rendered HTML to see what elements are present and what their CSS rules are.
20+
21+
When setting **percentage values** (such as `100%` or `50%`), keep in mind the following - according to the web standards, elements which have their height set in percentage require that the height of their parent is also explicitly set. This requirement applies recursively until either an element with a pixel height or the html element is reached. Elements that are 100% high should not have margins, paddings, borders, or sibling elements.
22+

components/animationcontainer/overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ To use the animation container, add the `TelerikAnimationContainer` tag.
2020
@using Telerik.Blazor.Components.AnimationContainer
2121
@using Telerik.Blazor.Components.Button
2222
23-
<TelerikAnimationContainer Top="300" Width="100" Height="100" Visible="@Shown" AnimationType="AnimationType.ZoomOut" Class="k-popup">
23+
<TelerikAnimationContainer Top="300px" Width="100px" Height="100px" Visible="@Shown" AnimationType="AnimationType.ZoomOut" Class="k-popup">
2424
My content goes here. The "k-popup" class adds some background and borders which you can define through your own styles instead.
2525
</TelerikAnimationContainer>
2626
@@ -64,7 +64,7 @@ The animation container exposes the following properties:
6464
@using Telerik.Blazor.Components.AnimationContainer
6565
@using Telerik.Blazor.Components.Button
6666
67-
<TelerikAnimationContainer Top="300" Width="100" Height="100" Visible="@Shown" AnimationType="@AnimType" Class="my-popup">
67+
<TelerikAnimationContainer Top="300px" Width="100px" Height="100px" Visible="@Shown" AnimationType="@AnimType" Class="my-popup">
6868
My content goes here.
6969
</TelerikAnimationContainer>
7070

components/dateinput/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ The date input provides the following features:
6464
* `Format` - the date format that the user input must match.
6565
* `ParsingErrorMessage` - a hint that is displayed to the user through validation when their input cannot be parsed in the required format
6666
* `Value` - get/set the value of the input, can be used for binding.
67-
* `Width` - the width of the `input` in pixels.
67+
* `Width` - the width of the `input`. See the [Dimensions]({%slug common-features/dimensions%}) article.
6868
* Validation - see the [Input Validation]({%slug common-features/input-validation%}) article.
6969

7070

components/datepicker/overview.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ The Date Picker component exposes the following features:
6161
* `BottomView` - Defines the bottommost view in the popup calendar to which the user can navigate to. Defaults to `CalendarView.Month`.
6262
* `DisabledDates` - Specifies a list of dates that can not be selected.
6363
* `Enabled` - Specifies whether typing in the input is allowed.
64-
* `Height` - Defines the height of the DatePicker. Defaults to 28.
64+
* `Height` - Defines the height of the DatePicker. Defaults to `28px`. See the [Dimensions]({%slug common-features/dimensions%}) article.
6565
* `Format` - Specifies the format of the DateInput of the DatePicker. Defaults to `yyyy-MM-dd`.
66-
* `PopupHeight` - Defines the height of the DatePicker's Popup. Defaults to 280;
67-
* `PopupWidth` - Defines the width of the DatePicker's Popup. Defaults to 320.
66+
* `PopupHeight` - Defines the height of the DatePicker's Popup. Defaults to `280px`.
67+
* `PopupWidth` - Defines the width of the DatePicker's Popup. Defaults to `320px`.
6868
* `Value` - The current value of the input. Can be used for binding.
6969
* `View` - Specifies the current view that will be displayed in the popup calendar.
70-
* `Width` - Defines the width of the DatePicker. Defaults to 280.
70+
* `Width` - Defines the width of the DatePicker. Defaults to `280px`.
7171
* Validation - see the [Input Validation]({%slug common-features/input-validation%}) article.
7272

7373
The date picker is, essentially, a [date input]({%slug components/dateinput/overview%}) and a [calendar]({%slug components/calendar/overview%}) and the properties it exposes are mapped to the corresponding properties of these two components. You can read more about their behavior in the respective components' documentation.

components/dropdownlist/overview.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ The DropDownList provides the following features:
8282
* `Data` - allows you to provide the data source. Required.
8383
* `DefaultItem` - sets the hint that is shown if no other item is selected. Set this property to an instance of the model class to which the dropdown is bound.
8484
* `Enabled` - whether the component is enabled.
85-
* `Height` - the height of the main element in pixels.
86-
* `PopupHeight` - the height of the expanded dropdown list element in pixels.
85+
* `Height` - the height of the main element. See the [Dimensions]({%slug common-features/dimensions%}) article.
86+
* `PopupHeight` - the height of the expanded dropdown list element.
8787
* `T` - the type of the model to which the component is bound. Required. Determines the type of the reference object.
8888
* `TItem` - the type of the value field from the model to which the component is bound. Required. Determines the type of the reference object.
8989
* `TabIndex` - the `tabindex` attribute rendered on the dropdown.
@@ -98,7 +98,7 @@ The DropDownList provides the following features:
9898
* `Guid`
9999
* `Enum`
100100

101-
* `Width` - the width of the dropdown in pixels.
101+
* `Width` - the width of the dropdown and the main element.
102102
* Templates - they allow you to control the rendering of items in the component. See the [Templates]({%slug components/dropdownlist/templates%}) article for more details.
103103
* Validation - see the [Input Validation]({%slug common-features/input-validation%}) article for more details.
104104

components/grid/columns/bound.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ They are added to the `TelerikGridColumns` tag and are of type `TelerikGridColum
1818
* `Title` - the text that is rendered in the column header.
1919
* `Editable` - you can set this property to `true` or `false` to allow or prevent [editing]({%slug components/grid/overview%}#editing) of this field. Defaults to `true`.
2020
* `Filterable` - you can set this to `false` so a [filterable]({%slug components/grid/filtering%}) grid will not let the user filter that particular column.
21-
* `Width` - the width of the column in pixels.
21+
* `Width` - the width of the column. See the [Dimensions]({%slug common-features/dimensions%}) article. Keep in mind that these are columns in a `<table>`, so it is often a good practice to leave one column without explicit dimensions so it can accommodate the remaining width and changes to the container size.
2222
* `Template` - this property can also be used as an inner tag and it lets you define the [column display content]({%slug components/grid/features/templates%}#column-template). It can also point to a component name.
2323
* `Context` - the standard Blazor context variable name for use inside the inline template.
2424
* `ref` - the standard Blazor reference name.

components/grid/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ The grid can filter data automatically. You can read more about thsi feature in
128128

129129
You can define your own content for column cells or even the entire row through [Templates]({%slug components/grid/features/templates%}).
130130

131-
You can also set the `Height` of the grid in pixels, and you can use the `Class` to provide more complex CSS rules (like ones that will be inherited in a template).
131+
You can also set the [`Height` of the grid]({%slug common-features/dimensions%}), and you can use the `Class` to provide more complex CSS rules (like ones that will be inherited in a template).
132132

133133
## Toolbar
134134

components/textbox/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ The numeric textbox provides the following features:
6060
* `MinLength` - the minimum length of the text input by the user.
6161
* `Pattern` - the pattern that the user input must match.
6262
* `Value` - get/set the value of the input, can be used for binding.
63-
* `Width` - the width of the `input` in pixels.
63+
* `Width` - the width of the `input`. See the [Dimensions]({%slug common-features/dimensions%}) article.
6464
* Validation - see the [Input Validation]({%slug common-features/input-validation%}) article.
6565

6666
The length, enabled and pattern attributes are HTML attributes on the `<input />` element and it is up to the browser to honor them. For example, the `minlength` attribute is rarely taken into account, and the pattern is usually evaluated only upon form submission.

components/window/position.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ position: 2
1212

1313
The Window offers two ways for you to control its position:
1414

15-
* the `Top` and `Left` integer properties
15+
* the [`Top` and `Left` properties]({%slug common-features/dimensions%})
1616
* the `Centered` boolean property
1717

1818
>caption Set Top and Left offset to the Window
1919
2020
````CSHTML
2121
@using Telerik.Blazor.Components.Window
2222
23-
<TelerikWindow Top="50" Left="100" Visible="true">
23+
<TelerikWindow Top="50px" Left="100px" Visible="true">
2424
<TelerikWindowTitle>
2525
<strong>The Title</strong>
2626
</TelerikWindowTitle>

components/window/size.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ position: 1
1212

1313
The Window offers two ways for you to control its size:
1414

15-
* the `Width` and `Height` integer properties
15+
* the [`Width` and `Height` properties]({%slug common-features/dimensions%})
1616
* predefined dimensions through the `Size` property
1717

1818
>caption Set Width and Height to a Window
1919
2020
````CSHTML
2121
@using Telerik.Blazor.Components.Window
2222
23-
<TelerikWindow Width="600" Height="400" Visible="true">
23+
<TelerikWindow Width="600px" Height="400px" Visible="true">
2424
<TelerikWindowTitle>
2525
<strong>The Title</strong>
2626
</TelerikWindowTitle>

0 commit comments

Comments
 (0)