Skip to content
Draft
46 changes: 30 additions & 16 deletions skills/igniteui-blazor-components/references/data-display.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,30 @@ The parameter is **`IconName`**, not `Name` (`Name` is the framework element ide
## Card

```razor
<IgbCard style="width: 350px;">
<IgbCardMedia><img src="photo.jpg" alt="Card image" /></IgbCardMedia>
<IgbCardHeader>
<h3 slot="title">Jane Doe</h3>
<span slot="subtitle">Photographer</span>
</IgbCardHeader>
<IgbCardContent><p>A short description.</p></IgbCardContent>
<IgbCardActions>
<IgbButton slot="start" Variant="ButtonVariant.Flat">Like</IgbButton>
<IgbButton slot="end" Variant="ButtonVariant.Contained">Buy Now</IgbButton>
</IgbCardActions>
</IgbCard>
<div class="card-row">
<IgbCard>
<IgbCardMedia><img src="photo.jpg" alt="Card image" /></IgbCardMedia>
<IgbCardHeader>
<h3 slot="title">Jane Doe</h3>
<span slot="subtitle">Photographer</span>
</IgbCardHeader>
<IgbCardContent><p>A short description.</p></IgbCardContent>
<IgbCardActions>
<IgbButton slot="start" Variant="ButtonVariant.Flat">Like</IgbButton>
<IgbButton slot="end" Variant="ButtonVariant.Contained">Buy Now</IgbButton>
</IgbCardActions>
</IgbCard>
</div>
```

`IgbCard` has no default width — always give it one.
```css
/* MyView.razor.css */
.card-row ::deep igc-card {
width: 350px;
}
```

`IgbCard` has no width of its own — in a block container it stretches to the container's width, in a flex row it shrinks to its content — so give it one from CSS, not a `style` attribute. In a `.razor.css` file, use `::deep` under an element the view renders itself: `igc-card` carries no CSS-isolation attribute, so a plain `.my-card { … }` rule there never matches, even with `class="my-card"` on the `IgbCard`. In `app.css`, a `class` plus a plain rule works. `IgbCard` has no `Width` parameter: `Width="350px"` compiles, but only renders a `width` attribute on `igc-card`, which does not size it.

## List

Expand Down Expand Up @@ -89,18 +98,23 @@ The parameter is **`IconName`**, not `Name` (`Name` is the framework element ide
<IgbBadge Variant="StyleVariant.Primary">5</IgbBadge>
<IgbBadge Variant="StyleVariant.Danger" Shape="BadgeShape.Square" Dot="true" />

<IgbChip Selectable="true" Removable="true" Variant="StyleVariant.Info" Remove="OnChipRemoved">
<IgbChip Selectable="true" Removable="true" Variant="StyleVariant.Info" @bind-Selected="BlazorSelected" Remove="OnChipRemoved">
<IgbIcon slot="start" IconName="star" Collection="material" />
Blazor
</IgbChip>
<IgbChip Outlined="true" Variant="StyleVariant.Primary">Outlined</IgbChip>

@code {
void OnChipRemoved(IgbVoidEventArgs e) { }
bool BlazorSelected { get; set; }
void OnChipRemoved(IgbVoidEventArgs e) { } // the chip does not remove itself: drop it from your data here
}
```

`AvatarShape`: `Circle | Rounded | Square` — use `Shape`, there is no `RoundShape`. `StyleVariant` (shared by badge and chip): `Primary | Info | Success | Warning | Danger`; a chip without `Variant` has no color variant. `IgbChip` also has `Outlined`, `Selected` / `SelectedChanged` and a `Select` event.
`Remove` is an `EventCallback<IgbVoidEventArgs>`. `Outlined="true"` gives a transparent chip with a 1px border; with a `Variant` the border takes the variant color and the text stays the theme's text color (Indigo gives an outlined chip without `Variant` a light fill and a grey border). Selecting a chip adds a check icon. In Bootstrap and Material that is all it changes. In Fluent and Indigo, selecting a chip **without** a `Variant` also fills a non-outlined chip with the primary color and gives an outlined one a primary border and darker text. A chip with a `Variant` keeps its variant colors when selected, and an outlined chip is transparent when selected.

Without a `Variant`, restyle an outlined chip with `--ig-chip-outlined-background`, `--ig-chip-outlined-text-color` and `--ig-chip-border-color`; once it is selected these are replaced by `--ig-chip-selected-outlined-background`, `--ig-chip-selected-outlined-text-color` and `--ig-chip-selected-border-color`. With a `Variant`, the variant rules win over every background, text and border token (including `--ig-chip-background` / `--ig-chip-text-color`); size and shape tokens such as `--ig-chip-size` and `--ig-chip-border-radius` still apply. To recolor a variant chip, style the part, e.g. `.chips ::deep igc-chip[selected]::part(base) { background: …; border-color: …; color: …; }` in the view's `.razor.css`, where `.chips` is an element the view renders. Tokens alone do not outline a chip without `Outlined` (it gets no border). `IgbChip` also has `Selected` / `SelectedChanged` (`@bind-Selected`) and a `Select` event (`IgbComponentBoolValueChangedEventArgs`; `Detail` is the new state).

`AvatarShape`: `Circle | Rounded | Square` — use `Shape`, there is no `RoundShape`. `StyleVariant` (shared by badge and chip): `Primary | Info | Success | Warning | Danger`; a chip without `Variant` has no color variant.

`IgbBadge` is a non-interactive visual notification, such as a status or a count. It also works as a label, such as a category, a role ("Maintainer") or a tag. It defaults to `role="status"`. For a label, set a `role` that fits the context, for example `role="listitem"` in a `role="list"` row. `IgbChip` is interactive: a filter, a contextual action, or an item the user selects or removes. It renders a `<button>`, so it is focusable and has hover and pressed states.

Expand Down
19 changes: 14 additions & 5 deletions skills/igniteui-blazor-components/references/form-controls.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,33 @@ The examples compile in both packages, and the types shown are the full `IgniteU

## Text inputs

`IgbInput` and `IgbTextarea` share a base: `Label`, `Placeholder`, `Outlined`, `Disabled`, `Required`, `Invalid`, plus `Value` / `ValueChanged`.
`IgbInput` and `IgbTextarea` are separate components (`IgbTextarea` does not derive from `IgbInputBase`), but both take `Label`, `Placeholder`, `Outlined`, `Disabled`, `Required`, `Invalid`, `ReadOnly`, `MinLength` / `MaxLength`, plus `Value` / `ValueChanged`. Their typing events have **different names**.

```razor
<IgbInput @bind-Value="UserName" Label="Username" Placeholder="e.g. John Doe">
<IgbIcon slot="prefix" IconName="person" Collection="material" />
</IgbInput>

<IgbTextarea @bind-Value="Notes" Label="Notes" Rows="4" Resize="TextareaResize.Vertical" />
<IgbTextarea @bind-Value="Notes" Label="Notes" Rows="4" Resize="TextareaResize.Vertical" Input="OnNotesInput" />

@code {
string? UserName { get; set; }
string? Notes { get; set; }
void OnNotesInput(IgbComponentValueChangedEventArgs e) => Console.WriteLine(e.Detail);
}
```

| Member | Type | Notes |
|---|---|---|
| `Value` / `@bind-Value` | `string` | The correct way to read and write the value |
| `Value` / `@bind-Value` | `string` | The correct way to read and write the value. On both `IgbInput` and `IgbTextarea` the bound value updates on commit (blur / `Change`), not per keystroke; for live text handle `InputOcurred` (`IgbInput`) or `Input` (`IgbTextarea`) |
| `DisplayType` | `InputType` | `IgbInput` only — text, password, email, number, … |
| `InputOcurred` | `EventCallback<IgbComponentValueChangedEventArgs>` | Fires while typing (name is spelled with one `c`) |
| `InputOcurred` | `EventCallback<IgbComponentValueChangedEventArgs>` | `IgbInput` only — fires while typing (name is spelled with one `c`) |
| `Input` | `EventCallback<IgbComponentValueChangedEventArgs>` | `IgbTextarea` only — fires on every keystroke; `Detail` is the current text |
| `Change` | `EventCallback<IgbComponentValueChangedEventArgs>` | Fires on commit / blur |
| `Focus`, `Blur` | `EventCallback<IgbVoidEventArgs>` | |
| `Rows`, `Resize`, `Wrap`, `MaxLength` | | `IgbTextarea` only |
| `Rows`, `Resize`, `Wrap` | | `IgbTextarea` only |

A wrong event name does not fail the build: the unmatched attribute is passed to the element as text. `<IgbTextarea InputOcurred="OnInput" />` compiles without a warning, and the handler never runs.

`IgbInput` has **no** `GetValueAsync()`. Bind with `@bind-Value` instead of reading imperatively.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,19 @@ Full rules are in the theming skill's [`common-patterns.md`](../../igniteui-blaz
|---|---|
| `--ig-*` design tokens | **primary** — whenever a token exists for the property |
| `::part(name)` | only when no token covers it, and only after confirming the part name |
| `::deep` | only in `.razor.css`, only on `igc-*` selectors |
| `::deep` | only in `.razor.css`, only on `igc-*` selectors or on a `class` you set on an `Igb*` component (it lands on the `igc-*` element, which has no scope attribute) |

```css
/* app.css — global, no ::deep */
igc-chip { --ig-chip-background: var(--ig-primary-500); }
igc-dialog::part(footer) { border-top: 1px solid var(--ig-gray-200); }

/* MyView.razor.css — ::deep on igc-*, never on your own class selectors */
/* MyView.razor.css — ::deep before igc-* selectors (and classes set on Igb* components); a plain .my-class for your own HTML */
::deep igc-chip { --ig-chip-background: var(--ig-primary-500); }
.dashboard-shell { display: grid; grid-template-columns: 260px 1fr; }
```

`::deep` does **not** work on the component's own root element — Blazor puts the scope attribute there, so there is no scoped parent above it. Never add `::deep` to a `:root {}` block. `create_component_theme` emits global CSS; use it verbatim in `app.css`. Blazor projects have no Sass step.
`::deep` does **not** work on the component's own root element — Blazor puts the scope attribute there, so there is no scoped parent above it. For the same reason `::deep igc-chip` matches only chips inside an HTML element the view renders; a chip at the top level of the view needs a wrapper element. Never add `::deep` to a `:root {}` block. `create_component_theme` emits global CSS; use it verbatim in `app.css`. Blazor projects have no Sass step.

## Charts

Expand Down
4 changes: 2 additions & 2 deletions skills/igniteui-blazor-grids/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
license: MIT
name: igniteui-blazor-grids
description: "Covers all Ignite UI for Blazor data grids (Grid Lite, Flat Grid, Tree Grid, Hierarchical Grid, Pivot Grid): setup, columns and templates, sorting, filtering, selection, cell and row editing, grouping, summaries, toolbar, Excel/CSV export, paging, remote and server-side data, virtualization, sizing, state persistence, and migrating Grid Lite to IgbGrid. WHEN TO USE: grids, tables, tabular data, cell editing, row selection, column pinning or hiding, grouped rows, pivot tables, tree or hierarchical data, master-detail views, grid export, or choosing a grid type. WHEN NOT TO USE: non-grid components such as lists, the tree view, or charts (use igniteui-blazor-components), grid colors, themes, or design tokens (use igniteui-blazor-theming), or building a whole view from a design image (use igniteui-blazor-generate-from-image-design)."
description: "Covers all Ignite UI for Blazor data grids (Grid Lite, Flat Grid, Tree Grid, Hierarchical Grid, Pivot Grid): setup, columns and templates, sorting, filtering, selection, cell and row editing, grouping, summaries, toolbar, Excel/CSV/PDF export, paging, remote and server-side data, virtualization, sizing, state persistence, and migrating Grid Lite to IgbGrid. WHEN TO USE: grids, tables, tabular data, cell editing, row selection, column pinning or hiding, grouped rows, pivot tables, tree or hierarchical data, master-detail views, grid export, or choosing a grid type. WHEN NOT TO USE: non-grid components such as lists, the tree view, or charts (use igniteui-blazor-components), grid colors, themes, or design tokens (use igniteui-blazor-theming), or building a whole view from a design image (use igniteui-blazor-generate-from-image-design)."
user-invocable: true
---

Expand All @@ -21,7 +21,7 @@ user-invocable: true
| Task | Read |
|---|---|
| Quick start, columns, data types, cell/header/editor templates, column groups, multi-row layout, pinning, sorting UI, filtering UI, selection | [`references/structure.md`](./references/structure.md) |
| Grouping, summaries, cell merging, toolbar, Excel/CSV export, virtualization, row drag, action strip, master-detail, clipboard | [`references/features.md`](./references/features.md) |
| Grouping, summaries, cell merging, toolbar, Excel/CSV/PDF export, virtualization, row drag, action strip, master-detail, clipboard | [`references/features.md`](./references/features.md) |
| Grid Lite, Tree Grid, Hierarchical Grid, Pivot Grid specifics | [`references/types.md`](./references/types.md) |
| Programmatic sort / filter / group, `@ref` access, custom strategies | [`references/data-operations.md`](./references/data-operations.md) |
| Cell editing, row editing, validation, custom editors, add/delete rows | [`references/editing.md`](./references/editing.md) |
Expand Down
2 changes: 1 addition & 1 deletion skills/igniteui-blazor-grids/references/editing.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Applies to `IgbGrid`, `IgbTreeGrid`, and `IgbHierarchicalGrid`. **`IgbPivotGrid`
| Cell editing | `Editable="true"` on each column | blur, Enter, Tab | quick single-value edits |
| Row editing | `RowEditable="true"` on the grid | the Done button in the row overlay | multi-field changes — **prefer this for CRUD** |

Row editing gives a clear confirm/cancel flow and prevents half-updated rows. Both modes still need `Editable="true"` on the individual columns.
Row editing gives a clear confirm/cancel flow and prevents half-updated rows. Cell editing needs `Editable="true"` on each column; with `RowEditable="true"` a column without an explicit `Editable` is editable by default (the primary-key column never is), so set `Editable="false"` on columns that must stay read-only.

## Cell editing

Expand Down
51 changes: 46 additions & 5 deletions skills/igniteui-blazor-grids/references/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,42 @@ Merges visually identical adjacent cells. Sort by the merged columns first, or t

## Export

`IgbGridToolbarExporter` offers Export to Excel, CSV **and PDF** by default (`ExportExcel`, `ExportCSV`, `ExportPDF` all default to `true`); set the unwanted ones to `false` — Excel only is `ExportCSV="false" ExportPDF="false"`. PDF needs no extra module or script. `Filename` defaults to `ExportedData`.

```razor
<IgbGridToolbarExporter @ref="exporter" ExportExcel="true" ExportCSV="true" Filename="employees" />
@inject IJSRuntime JS

<div @ref="employeesHost">
<IgbGrid Data="employees" PrimaryKey="Id">
<IgbGridToolbar>
<IgbGridToolbarActions>
<IgbGridToolbarExporter ExportExcel="true" ExportCSV="true" ExportPDF="false" Filename="employees" />
</IgbGridToolbarActions>
</IgbGridToolbar>
…
</IgbGrid>
</div>

@code {
private IgbGridToolbarExporter exporter = default!;
private ElementReference employeesHost; // one host per grid, so each export targets its own grid

private Task ExportToExcel() => exporter.ExportGridAsync(GridToolbarExporterType.Excel);
private Task ExportToCsv() => exporter.ExportGridAsync(GridToolbarExporterType.CSV);
private async Task ExportToExcel() => await JS.InvokeVoidAsync("exportGrid", employeesHost, "excel");
private async Task ExportToCsv() => await JS.InvokeVoidAsync("exportGrid", employeesHost, "csv");
}
```

```js
// wwwroot/js/export-grid.js — export() on the toolbar exporter inside the host element: "excel" | "csv" | "pdf"
window.exportGrid = (host, type) => host.querySelector('igc-grid-toolbar-exporter').export(type);
```

```html
<!-- host page (wwwroot/index.html, or App.razor in a Blazor Web App) -->
<script src="js/export-grid.js"></script>
```

To export from code, call the element's `export()` through JS interop as above — this needs an `IgbGridToolbarExporter` in the grid's toolbar (without one the helper throws a `JSException`: `Cannot read properties of null`). `ExportCSV` / `ExportPDF="false"` only hide that format in the menu; `export('csv')` / `export('pdf')` still work. Passing the grid's host element keeps the export on that grid when the page has several. The C# `ExportGridAsync` / `ExportGrid` fail: the console logs `target doesn't have prop: export`, .NET throws an `InvalidOperationException`, and nothing downloads. The `GridToolbarExporterType` values are `Excel`, `Csv`, `Pdf` — not `CSV`. `ExportStarted` / `ExportEnded` fire for every export, but in the C# `ExportStarted` args `Detail.Options` and `Detail.Grid` are always `null`, and the export cannot be cancelled (`IgbExporterEventArgsDetail` has no `Cancel`).

Configure or cancel an export from the grid's `ToolbarExporting` event. In Blazor the practical hook is the JS variant, because the exporter's own per-column and per-row events are only reachable from script:

```razor
Expand Down Expand Up @@ -154,7 +179,23 @@ Row and column virtualization are on by default once the grid has a fixed `Heigh
</IgbGrid>
```

`IgbGridEditingActions` renders edit/delete (plus add-row when `AddRow="true"`) and needs `RowEditable="true"` on the grid to function. `IgbGridPinningActions` renders row pin/unpin. Extra buttons can be placed inside `IgbActionStrip` alongside them.
`IgbGridEditingActions` shows Edit and Delete by default (`EditRow` and `DeleteRow` default to `true`). `AddRow="true"` adds an Add button on root rows; on `IgbTreeGrid`, `AddChild="true"` adds an Add Child button. Set `EditRow="false"` or `DeleteRow="false"` to hide one. What each needs:

- **Delete** removes the row by key — it needs `PrimaryKey`, not `RowEditable`; without `PrimaryKey` it silently does nothing. It also removes the row from the bound `List<T>` instance itself (not from a list that one was copied from), but the page does not re-render: `RowDeleted` is an `Action<T>`, so call `StateHasChanged()` in its handler when something else on the page (a count, a summary) depends on the list.
- **Edit** enters row editing with `RowEditable="true"` (which also makes the non-key columns editable), or cell editing on the first `Editable="true"` column without it. With no editable column it silently does nothing.
- **Add / Add Child** need `RowEditable="true"`; otherwise they only log a console warning.

`IgbGridPinningActions` renders row pin/unpin and needs neither. `AsMenuItems="true"` on an actions component moves its buttons into a "More" (⋮) menu. Extra buttons can be placed inside `IgbActionStrip` alongside them.

```razor
@* delete-only strip, no row editing *@
<IgbGrid Data="data" PrimaryKey="Id">
<IgbColumn Field="Name" />
<IgbActionStrip>
<IgbGridEditingActions EditRow="false" />
</IgbActionStrip>
</IgbGrid>
```

## Master-detail — `IgbGrid` only

Expand Down
Loading
Loading