Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/contextmenu/accessibility/wai-aria-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ This section lists the selectors, attributes, and behavior patterns supported by
| Selector | Attribute | Usage |
| -------- | --------- | ----- |
| `.k-context-menu` | `role=menu` | The context menu implements the `menu` role. |
| `.k-menu-group-header` | `role=presentation` | The group headers are not interactive. They have no `tabindex` and are excluded from the focus and the keyboard navigation. |


Apart from the above, the ContextMenu element should implement the specification for a vertical **Menu** component.
Expand Down
16 changes: 8 additions & 8 deletions components/contextmenu/data-binding/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ The menu items provide the following features that you control through the corre

* `Disabled` - You can disable items by setting this field to `true`. Such items will keep rendering but will not be clickable.

* `Description` - an optional secondary line of text below the item text. The Context Menu renders the description only when you set the `DescriptionField` parameter and the field value is a non-empty `string`. If the field is missing or is not a `string`, the Context Menu does not render a description.

* `GroupHeader` - when set to `true`, the item renders as a non-interactive group header. The group header organizes the items that follow it. The Context Menu supports group headers both at the root level and in child popups. [Read more about item grouping...](slug:contextmenu-item-grouping)

## Data Bindings

The properties of a menu item match directly to a field of the model the menu is bound to. You provide that relationship by providing the name of the field from which the corresponding information is present. To do this, use the properties in the main `TelerikMenu` tag:
Expand All @@ -61,10 +65,12 @@ The properties of a menu item match directly to a field of the model the menu is
* UrlField => Url
* HasChildrenField => HasChildren
* ItemsField => Items
* DisabledField => DisabledField
* DisabledField => Disabled
* SeparatorField => Separator
* DescriptionField => no default value. Set this parameter to display item descriptions.
* GroupHeaderField => GroupHeader

>tip There are default values for the field names. If your model names match the defaults, you don't have to define them in the bindings settings.
>tip There are default values for the field names. If your model names match the defaults, you don't have to define them in the bindings settings. The only exception is `DescriptionField`, which you must set explicitly to display descriptions.

@[template](/_contentTemplates/common/navigation-components.md#default-fields-match-issues)

Expand All @@ -76,12 +82,6 @@ The properties of a menu item match directly to a field of the model the menu is

<demo metaUrl="client/contextmenu/data-binding/custom-field-names/" height="300"></demo>

>caption The result from the snippet above

![context menu data binding example](images/context-menu-databinding-example.png)



## See Also

* [Binding to Flat Data](slug:contextmenu-data-binding-flat-data)
Expand Down
32 changes: 32 additions & 0 deletions components/contextmenu/item-grouping.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: Item Grouping
page_title: Context Menu - Item Grouping
description: Organize Context Menu items under labeled group headers in Blazor.
slug: contextmenu-item-grouping
tags: telerik,blazor,context menu,item grouping,group headers
published: True
position: 7
components: ["contextmenu"]
---

# Context Menu Item Grouping

The Context Menu can organize its items under labeled group headers. To create a group header, set the [`GroupHeader` property](slug:contextmenu-data-binding-overview#context-menu-item-features) of an item to `true`. The group header applies to the items that follow it until the next group header.

Unlike the [Menu](slug:components/menu/templates#groupheadertemplate), the Context Menu supports group headers both at the root level and in child popups.

Group headers have the following behavior:

* They are not interactive. The Context Menu does not focus group headers and skips them during keyboard navigation.
* They are different from [separators](slug:contextmenu-data-binding-overview#context-menu-item-features). You can use both in the same list of items.

By default, the group header displays the item text and icon. To customize this content, use the [Context Menu group header template](slug:contextmenu-group-header-template).

>caption Group Context Menu items under labeled headers

<demo metaUrl="client/contextmenu/item-grouping/" height="400"></demo>

## See Also

* [Context Menu Group Header Template](slug:contextmenu-group-header-template)
* [Data Binding a Context Menu](slug:contextmenu-data-binding-overview)
9 changes: 9 additions & 0 deletions components/contextmenu/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ To illustrate the purpose of each Context Menu item, the Blazor Context Menu all

You can use the functionality of the built-in templates and customize what is rendered in the items. [Read more about the available Blazor Context Menu templates...](slug:contextmenu-templates-overview)

## Descriptions, Item Actions, and Group Headers

The Context Menu items can display additional content and structure:

* A description, which is a secondary line of text below the item label. Set the `DescriptionField` parameter to enable it. [Read more about Context Menu data bindings...](slug:contextmenu-data-binding-overview#data-bindings)
* Trailing content, such as a keyboard shortcut, before the expand arrow. [Read more about the Context Menu item actions template...](slug:contextmenu-item-actions-template)
* Group headers, which organize the items under labeled sections at the root level and in child popups. [Read more about Context Menu item grouping...](slug:contextmenu-item-grouping)

## Events

The Context Menu generates events that you can handle and further customize its behavior. [Read more about the supported Blazor Context Menu events...](slug:contextmenu-events)
Expand All @@ -64,6 +72,7 @@ The following table lists Context Menu parameters, which are not related to othe
| --- | --- | --- |
| `Class` | `string` | Renders an additional CSS class to the main wrapping element of the component. Use it to apply custom styles or [override the theme](slug:themes-override). |
| `Selector` | `string` | A CSS selector of the target elements where the Context Menu will be shown.|
| `Size` | `string` <br /> (`ThemeConstants.Menu.Size.Medium`) | The size of the Context Menu items. Use the members of the `ThemeConstants.Menu.Size` class: `Small`, `Medium`, or `Large`. When set to `null`, the component renders no size CSS class. [Read more about the Menu appearance](slug:components/menu/appearance). |

### Popup settings

Expand Down
36 changes: 36 additions & 0 deletions components/contextmenu/templates/group-header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Group Header Template
page_title: Context Menu - Group Header Template
description: Organize the Context Menu for Blazor items under labeled group headers and customize the group header content with a template.
slug: contextmenu-group-header-template
tags: telerik,blazor,context menu,templates,group header
published: True
position: 14
components: ["contextmenu"]
---

# Context Menu Group Header Template

Use the `GroupHeaderTemplate` to render custom content in a [Context Menu group header](slug:contextmenu-item-grouping).

The template receives a `GroupHeaderTemplateContext<TItem>` object as its `context`. The object exposes the following properties:

@[template](/_contentTemplates/common/parameters-table-styles.md#table-layout)

| Property | Type | Description |
| --- | --- | --- |
| `Item` | `TItem` | The data item of the current group header. |
| `Index` | `string` | The position of the group header in the data hierarchy. The value uses the same format as the `Index` of the [`ItemActionsTemplate` context](slug:contextmenu-item-actions-template). |

>note The content of the `GroupHeaderTemplate` must remain non-interactive. Do not render buttons, links, or other focusable elements in it.

>caption Customize the Context Menu group headers

<demo metaUrl="client/contextmenu/templates/group-header/" height="400"></demo>

## See Also

* [Context Menu Templates Overview](slug:contextmenu-templates-overview)
* [Context Menu Item Grouping](slug:contextmenu-item-grouping)
* [Context Menu Item Actions Template](slug:contextmenu-item-actions-template)
* [Data Binding a Context Menu](slug:contextmenu-data-binding-overview)
37 changes: 37 additions & 0 deletions components/contextmenu/templates/item-actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: Item Actions Template
page_title: Context Menu - Item Actions Template
description: Use the Item Actions Template in the Context Menu for Blazor to render trailing content, such as keyboard shortcuts, in the menu items.
slug: contextmenu-item-actions-template
tags: telerik,blazor,context menu,templates,item actions,shortcut
published: True
position: 12
components: ["contextmenu"]
---

# Context Menu Item Actions Template
Comment thread
IvanDanchev marked this conversation as resolved.
Resolved

The Context Menu `ItemActionsTemplate` renders optional trailing content in each item, for example, a keyboard shortcut, metadata, or a hint. The Context Menu renders this content after the item text and [description](slug:contextmenu-data-binding-overview#context-menu-item-features), and before the expand arrow of items with children.

The template receives an `ItemActionsTemplateContext<TItem>` object as its `context`. The object exposes the following properties:

@[template](/_contentTemplates/common/parameters-table-styles.md#table-layout)

| Property | Type | Description |
| --- | --- | --- |
| `Item` | `TItem` | The data item of the current Context Menu item. |
| `Index` | `string` | The position of the item in the data hierarchy. The indexes of the different levels are joined by an underscore. For example, `"1_3"` is the fourth child of the second root item. The value counts group headers and separators, so it is unique across the `ItemActionsTemplate` and the [`GroupHeaderTemplate`](slug:contextmenu-group-header-template). |

The `ItemActionsTemplate` works independently of the [`ItemTemplate`](slug:contextmenu-item-template). The `ItemTemplate` replaces only the default icon and text of the item.

>note The Context Menu does not provide keyboard navigation for the content of the `ItemActionsTemplate`. Use the template for informational content, such as shortcuts, rather than for interactive elements.

>caption Show keyboard shortcuts and descriptions in the Context Menu items

<demo metaUrl="client/contextmenu/templates/item-actions/" height="400"></demo>

## See Also

* [Context Menu Templates Overview](slug:contextmenu-templates-overview)
* [Context Menu Group Header Template](slug:contextmenu-group-header-template)
* [Data Binding a Context Menu](slug:contextmenu-data-binding-overview)
2 changes: 2 additions & 0 deletions components/contextmenu/templates/item.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ The template receives the model to which the item is bound as its `context`. You

You can use the template to render arbitrary content according to your application's data and logic. You can use components in it and thus provide rich content instead of plain text. You can also use it to add DOM event handlers like click, doubleclick, mouseover if you need to respond to them.

>note The `ItemTemplate` replaces only the default icon and text of the item. The Context Menu continues to render the [item description](slug:contextmenu-data-binding-overview#context-menu-item-features) and the [`ItemActionsTemplate`](slug:contextmenu-item-actions-template) content outside of the `ItemTemplate`.

>caption Use templates to implement custom navigation between views without the UrlField feature

<demo metaUrl="client/contextmenu/templates/item/" height="300"></demo>
Expand Down
4 changes: 4 additions & 0 deletions components/contextmenu/templates/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ The Context Menu component provides templates you can use to customize its appea

* [Content Template](slug:contextmenu-content-template) - lets you control the rendering of the entire popup, without having to us the built-in `<ul> --> <li>` structure.

* [Item Actions Template](slug:contextmenu-item-actions-template) - renders trailing content in each item, such as a keyboard shortcut, before the expand arrow.

* [Group Header Template](slug:contextmenu-group-header-template) - customizes the content of the non-interactive group headers that organize the items.


## See Also

Expand Down
1 change: 1 addition & 0 deletions components/menu/accessibility/wai-aria-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ This section lists the selectors, attributes, and behavior patterns supported by
| `.k-menu-item[aria-haspopup]` | `aria-expanded=true/false` | Indicates whether the item is expanded. |
| `.k-menu-item.k-disabled` | `aria-disabled=true` | Informs assistive technologies that a Menu item is disabled. |
| `.k-menu-expand-arrow` | `aria-hidden=true` | The Menu item expand arrow elements are hidden from the assistive technologies. |
| `.k-menu-group-header` | `role=presentation` | The group headers are not interactive. They have no `tabindex` and are excluded from the focus and the keyboard navigation. |
| `.k-menu-popup .k-menu-group` | `role=menu` | The role of the nested (not root-level) menu displayed in a popup. |
| | `id` | Each nested menu has a deterministic id attribute that is linked to the aria-controls attribute ot its parent. |

Expand Down
46 changes: 46 additions & 0 deletions components/menu/appearance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: Appearance
page_title: Menu Appearance
description: Appearance settings of the Menu for Blazor. Learn how to change the size of the Menu items.
slug: components/menu/appearance
tags: telerik,blazor,menu,appearance,size
published: True
position: 7
components: ["menu"]
---

# Menu Appearance Settings

You can control the appearance of the Menu by setting the [Size](#size) parameter.

## Size

You can increase or decrease the size of the Menu items by setting the `Size` parameter to a member of the [`Telerik.Blazor.ThemeConstants.Menu.Size`](slug:telerik.blazor.themeconstants.menu.size) class. The `Size` parameter determines styles like `padding`, `font-size`, and `line-height` of the Menu links.

@[template](/_contentTemplates/common/parameters-table-styles.md#table-layout)

| Class members | Manual declarations |
|------------|--------|
|`Small` |`sm`|
|`Medium` <br /> default value|`md`|
|`Large`|`lg`|

The `Size` parameter affects:

* The root items in both [horizontal and vertical orientation](slug:components/menu/orientation).
* The child items in the Menu popups.
* The items of the [ContextMenu](slug:contextmenu-overview), which also exposes a `Size` parameter.

When you set `Size` to `null`, the Menu does not render a size CSS class. In this case, the Menu items rely only on your custom CSS styles.

>caption Built-in Menu sizes

<demo metaUrl="client/menu/appearance/example-1/" height="300"></demo>
Comment thread
dimodi marked this conversation as resolved.
Resolved

@[template](/_contentTemplates/common/themebuilder-section.md#appearance-themebuilder)

## See Also

* [Live Demo: Menu Appearance](https://demos.telerik.com/blazor-ui/menu/appearance)
* [Menu Orientation](slug:components/menu/orientation)
* [Menu API Reference](slug:Telerik.Blazor.Components.TelerikMenu-1)
14 changes: 13 additions & 1 deletion components/menu/data-binding/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ The menu items provide the following features that you control through the corre

* `Disabled` - You can disable items by setting this field to `true`. Such items will keep rendering but will not be clickable.

* `Description` - an optional secondary line of text below the item text. The Menu renders the description only when you set the `DescriptionField` parameter and the field value is a non-empty `string`. If the field is missing or is not a `string`, the Menu does not render a description.

* `GroupHeader` - when set to `true`, the child item renders as a non-interactive group header in its popup. The group header organizes the items that follow it. The root items of the Menu ignore this field. [Read more about item grouping...](slug:components/menu/item-grouping)

## Data Bindings

The properties of a menu item match directly to a field of the model the menu is bound to. You provide that relationship by providing the name of the field from which the corresponding information is present. To do this, use the properties in the main `TelerikMenu` tag:
Expand All @@ -63,8 +67,12 @@ The properties of a menu item match directly to a field of the model the menu is
* ItemsField => Items
* DisabledField => Disabled
* SeparatorField => Separator
* DescriptionField => no default value. Set this parameter to display item descriptions.
* GroupHeaderField => GroupHeader

>tip There are default values for the field names. If your model names match the defaults, you don't have to define them in the bindings settings.
>tip There are default values for the field names. If your model names match the defaults, you don't have to define them in the bindings settings. The only exception is `DescriptionField`, which you must set explicitly to display descriptions.

>note If your model has a `GroupHeader` property with a `true` value, the Menu renders the respective child items as group headers, even if you don't set `GroupHeaderField`.

@[template](/_contentTemplates/common/navigation-components.md#default-fields-match-issues)

Expand All @@ -81,6 +89,7 @@ public class MenuItem
public string Url { get; set; }
public bool Disabled { get; set; }
public bool Separator { get; set; }
public bool GroupHeader { get; set; }
}
````

Expand All @@ -92,6 +101,9 @@ public class MenuItem

![Menu data binding example with custom field names](images/menu-databinding-example.png)

>caption Bind the item descriptions and group headers to custom fields

<demo metaUrl="client/menu/data-binding/example-1/" height="360"></demo>


## See Also
Expand Down
31 changes: 31 additions & 0 deletions components/menu/item-grouping.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: Item Grouping
page_title: Menu - Item Grouping
description: Organize Menu child items under labeled group headers in Blazor.
slug: components/menu/item-grouping
tags: telerik,blazor,menu,item grouping,group headers
published: True
position: 7
components: ["menu"]
---

# Menu Item Grouping

The Menu can organize child items in a popup under labeled group headers. To create a group header, set the [`GroupHeader` field](slug:components/menu/data-binding/overview#menu-item-features) of a child item to `true`. The group header applies to the items that follow it until the next group header.

Group headers have the following behavior:

* They are not interactive. The Menu does not focus group headers and skips them during keyboard navigation.
* They are different from [separators](slug:components/menu/data-binding/overview#menu-item-features). You can use both in the same popup.
* They apply only to child items. The root items of the Menu ignore the `GroupHeader` field and render as regular items. The [ContextMenu](slug:contextmenu-item-grouping) supports group headers at the root level too.

By default, the group header displays the item text and icon. To customize this content, use the [Menu group header template](slug:components/menu/templates#groupheadertemplate).

>caption Group Menu child items under labeled headers

<demo metaUrl="client/menu/item-grouping/" height="360"></demo>

## See Also

* [Menu Group Header Template](slug:components/menu/templates#groupheadertemplate)
* [Data Binding a Menu](slug:components/menu/data-binding/overview)
Loading
Loading