DwsPaper
DwsPaper is a surface that groups content. It takes the theme's surface and text colors and a light shadow by default; elevation, colors, background image, transparency, border, corners and spacing are all parameters. A clickable paper behaves like a button for mouse and keyboard.
API ReferenceBasic
A paper with the default look: surface color, theme text color, theme corner radius and elevation 1. Width, Height and their Min/Max variants, Margin and Padding are given in pixels.
Paper groups related content on a surface of its own.
Show Code
Paper.razor
<DwsPaper Name='PaperDemo_Basic' Padding='16' MaxWidth='480'>
<p class='m-0'>Paper groups related content on a surface of its own.</p>
</DwsPaper>Elevation
Elevation sets the depth of the shadow from 0 (flat) to 5.
Show Code
Paper.razor
@foreach (int level in Enumerable.Range(0, 6))
{
<DwsPaper Name='@($"PaperDemo_Elevation_{level}")' Elevation='level' Width='110' Height='80' Padding='12'>
Elevation @level
</DwsPaper>
}Shadow color
ShadowColor tints the shadow with a theme color.
Show Code
Paper.razor
<DwsPaper Name='PaperDemo_Shadow_Primary' Elevation='5' ShadowColor='DwsColor.Primary' Width='140' Height='80' Padding='12'>Primary shadow</DwsPaper>
<DwsPaper Name='PaperDemo_Shadow_Error' Elevation='5' ShadowColor='DwsColor.Error' Width='140' Height='80' Padding='12'>Error shadow</DwsPaper>
<DwsPaper Name='PaperDemo_Shadow_Success' Elevation='5' ShadowColor='DwsColor.Success' Width='140' Height='80' Padding='12'>Success shadow</DwsPaper>Background color
BackgroundColor and TextColor take theme colors, so the paper follows the active theme.
Show Code
Paper.razor
<DwsPaper Name='PaperDemo_Background_Primary' BackgroundColor='DwsColor.Primary' TextColor='DwsColor.PrimaryText' Width='160' Padding='16'>Primary</DwsPaper>
<DwsPaper Name='PaperDemo_Background_Accent' BackgroundColor='DwsColor.Accent' TextColor='DwsColor.PrimaryText' Width='160' Padding='16'>Accent</DwsPaper>
<DwsPaper Name='PaperDemo_Background_Warning' BackgroundColor='DwsColor.Warning' TextColor='DwsColor.PrimaryText' Width='160' Padding='16'>Warning</DwsPaper>Background image
BackgroundImage draws an image that covers the paper.
Show Code
Paper.razor
<DwsPaper Name='PaperDemo_Background_Image' BackgroundImage='images/blackhole_black.png' TextColor='DwsColor.White' Width='160' Height='160' Padding='16'>Background image</DwsPaper>Transparency
BackgroundOpacity (0 to 1) makes the background color see-through, while the content, border and shadow stay fully visible.
Show Code
Paper.razor
<DwsPaper Name='PaperDemo_Transparency_Backdrop' Style='background: repeating-linear-gradient(45deg, var(--primary) 0 16px, var(--accent) 16px 32px);' Elevation='0' Padding='24'>
<div class='d-flex flex-wrap gap-4'>
<DwsPaper Name='PaperDemo_Transparency_100' Width='150' Padding='16'>Opacity 1</DwsPaper>
<DwsPaper Name='PaperDemo_Transparency_70' BackgroundOpacity='0.7' Width='150' Padding='16'>Opacity 0.7</DwsPaper>
<DwsPaper Name='PaperDemo_Transparency_40' BackgroundOpacity='0.4' Width='150' Padding='16'>Opacity 0.4</DwsPaper>
<DwsPaper Name='PaperDemo_Transparency_0' BackgroundOpacity='0' TextColor='DwsColor.White'
BorderStyle='DwsBorderStyle.Dashed' BorderWidth='1' BorderColor='DwsColor.White' Width='150' Padding='16'>Opacity 0</DwsPaper>
</div>
</DwsPaper>Border
BorderStyle, BorderWidth and BorderColor draw a border.
Show Code
Paper.razor
<DwsPaper Name='PaperDemo_Border_Solid' BorderStyle='DwsBorderStyle.Solid' BorderWidth='2' BorderColor='DwsColor.Primary' Width='150' Padding='16'>Solid, 2px</DwsPaper>
<DwsPaper Name='PaperDemo_Border_Dashed' BorderStyle='DwsBorderStyle.Dashed' BorderWidth='2' BorderColor='DwsColor.Secondary' Width='150' Padding='16'>Dashed</DwsPaper>
<DwsPaper Name='PaperDemo_Border_Dotted' BorderStyle='DwsBorderStyle.Dotted' BorderWidth='3' BorderColor='DwsColor.Error' Width='150' Padding='16'>Dotted</DwsPaper>
<DwsPaper Name='PaperDemo_Border_Flat' Elevation='0' BorderStyle='DwsBorderStyle.Solid' BorderWidth='1' BorderColor='DwsColor.Secondary' Width='150' Padding='16'>Outlined, flat</DwsPaper>Corners
BorderRadius sets the corner rounding in pixels (0 for square corners).
Show Code
Paper.razor
<DwsPaper Name='PaperDemo_Radius_Square' BorderRadius='0' Width='150' Padding='16'>Square corners</DwsPaper>
<DwsPaper Name='PaperDemo_Radius_Medium' BorderRadius='12' Width='150' Padding='16'>Radius 12</DwsPaper>
<DwsPaper Name='PaperDemo_Radius_Round' BorderRadius='24' Width='150' Padding='16'>Radius 24</DwsPaper>Hover effects
HoverEffect changes the paper while the pointer is over it: Raise deepens the shadow, Lift also moves it up, Highlight tints it and Outline draws an outline. HoverColor picks the theme color of the tint and the outline.
Show Code
Paper.razor
<DwsPaper Name='PaperDemo_Hover_Raise' HoverEffect='DwsPaperHoverEffect.Raise' Width='140' Height='80' Padding='12'>Raise</DwsPaper>
<DwsPaper Name='PaperDemo_Hover_Lift' HoverEffect='DwsPaperHoverEffect.Lift' Width='140' Height='80' Padding='12'>Lift</DwsPaper>
<DwsPaper Name='PaperDemo_Hover_Highlight' HoverEffect='DwsPaperHoverEffect.Highlight' HoverColor='DwsColor.Primary' Width='140' Height='80' Padding='12'>Highlight</DwsPaper>
<DwsPaper Name='PaperDemo_Hover_Outline' HoverEffect='DwsPaperHoverEffect.Outline' HoverColor='DwsColor.Accent' Width='140' Height='80' Padding='12'>Outline</DwsPaper>Interface-Description
| Name | Typ | Default | Description |
|---|---|---|---|
| ChildContent | RenderFragment? | null | The content of the paper. |
| AriaLabel | string? | null | The accessible name of the paper. Mostly useful together with Clickable. |
| Width | int? | null | The width in pixels. |
| Height | int? | null | The height in pixels. |
| MinWidth | int? | null | The minimum width in pixels. |
| MinHeight | int? | null | The minimum height in pixels. |
| MaxWidth | int? | null | The maximum width in pixels. |
| MaxHeight | int? | null | The maximum height in pixels. |
| Margin | int? | null | The outer spacing on all sides, in pixels. |
| Padding | int? | null | The inner spacing on all sides, in pixels. |
| BackgroundColor | DwsColor | DwsColor.Undefined | The theme color of the background. Undefined keeps the theme's surface color. |
| TextColor | DwsColor | DwsColor.Undefined | The theme color of the text. Undefined keeps the theme's text color. |
| BackgroundImage | string? | null | The URL of an image drawn behind the content. It covers the paper and is centered. |
| BackgroundOpacity | double? | null | The opacity of the background color, from 0 (transparent) to 1 (opaque). The content, border and background image stay opaque. |
| BorderStyle | DwsBorderStyle | DwsBorderStyle.None | The style of the border. None draws no border. |
| BorderWidth | int? | null | The width of the border in pixels. |
| BorderColor | DwsColor | DwsColor.Undefined | The theme color of the border. Undefined uses the text color. |
| BorderRadius | int? | null | The corner radius in pixels. Null keeps the theme's border radius; 0 gives square corners. |
| Elevation | int | 1 | The depth of the shadow, from 0 (none) to 5 (deepest). |
| ShadowColor | DwsColor | DwsColor.Undefined | The theme color of the shadow. Undefined keeps a black shadow. |
| Clickable | bool | false | Shows the paper as a button: pointer cursor, hover and press feedback, a focus ring and the button role. It can be reached with Tab and activated with Enter or Space. |
| AllowInteractiveContent | bool | false | For a Clickable paper with buttons, links or inputs inside: the paper is no button itself, one empty button is stretched over the surface (one Tab stop, named by AriaLabel or the paper's text) and the controls inside sit above it. A click on an inner control no longer raises OnClick. |
| HoverEffect | DwsPaperHoverEffect | DwsPaperHoverEffect.None | How the paper reacts to the pointer: Raise deepens the shadow, Lift also moves it up, Highlight tints the background and Outline draws an outline. |
| HoverColor | DwsColor | DwsColor.Undefined | The theme color of the Highlight tint and the Outline. Undefined uses the text color for the tint and the primary color for the outline. |
| StopClickPropagation | bool | false | Keeps clicks on the paper and inside it from reaching its parent elements. |
| Name | Typ | Description |
|---|---|---|
| OnClick | EventCallback<MouseEventArgs> | Raised when the paper is clicked, or activated with Enter or Space while it is Clickable. Not raised while the paper is disabled. |
| Name | Typ | Default | Description |
|---|---|---|---|
| Element | ElementReference | The associated web component. May be null if accessed before the component is rendered. | |
| ComponentGuid | Guid | Unique identifier for the component. | |
| TypeString | string | The name of the component type, obtained from reflection. | |
| Authorized_RegisterEnabled | bool | false | Indicates whether this component is enabled through a permission registry. |
| Authorized_RegisterSelected | bool | false | Indicates whether this component is selected in permission selection mode. |
| GetInitializedState | bool | false | Returns whether the component is initialized. |
| GetRenderModeState | DwsRenderMode | Returns the current render mode. | |
| GetComponentState | DwsComponentStateType | Returns the current component state. | |
| GetIsInteractiveState | bool | false | Returns whether the component is interactive. |
| GetIsPrerenderingState | bool | false | Returns whether the component is prerendering. |
| GetComponentLoadingState | bool | false | Returns whether the component is loading. |
| IsFormBusy | bool | false | Whether the DwsForm (or DwsFormBusyRegion) around the component is locked because its submit handler is running. The state itself is the cascaded FormBusyState (IDwsFormBusyState). |
| Name | Typ | Parameters | Description |
|---|---|---|---|
| DebugInfo | void | Logs debug information about the component. | |
| UpdateState | void | Updates the component's state and triggers StateHasChanged. | |
| UpdateStateAsync | Task | Asynchronously updates the component's state and triggers StateHasChanged. | |
| Dispose | void | Disposes the component and releases resources. | |
| FocusAsync | ValueTask | bool containedInScrollableList | Sets focus to the component's element. |
| Name | Typ | Default | Description |
|---|---|---|---|
| Name | string | Required unique identifier for the component within its container. | |
| Visible | bool | true | Determines if the component is visible in the UI. |
| Disabled | bool | false | Disables the form control, ensuring it doesn't participate in form submission. |
| ComponentNameSpace | string | The namespace for permission-based access control. | |
| PermissionKey | string? | null | A stable key that takes the place of Name in the generated permission namespace (Page.PermissionKey): the stored permission survives a rename, and components that share a key share one permission entry. Null: keyed by Name. Read once, when the component registers; an explicit ComponentNameSpace wins. |
| Class | string | Optional CSS class names. | |
| Style | string | Optional in-line styles. | |
| Tag | object | An optional user-defined object to store any additional data with the component. | |
| BackReference | DwsReference | A reference to the enclosing component. | |
| ID | string | The HTML ID attribute for the component. | |
| AdditionalAttributes | Dictionary<string, object> | Additional HTML attributes for the component's root element. | |
| IgnorePermissionChecks | bool | false | Bypasses all permission checks for this component. |
| IgnorePermissionSelection | bool | false | Ignore permission selection mode for this component. |
| IgnoreFormBusy | bool | false | Takes the component out of the submit lock of the DwsForm (or DwsFormBusyRegion) around it: IsFormBusy stays false for it. |
| Name | Typ | Description |
|---|---|---|
| OnInitializedCallbackStarted | EventCallback | Callback when OnInitialized starts. |
| OnInitializedCallback | EventCallback | Callback during OnInitialized. |
| OnInitializedCallbackCompleted | EventCallback | Callback when OnInitialized completes. |
| OnInitializedAsyncCallbackStarted | EventCallback | Callback when OnInitializedAsync starts. |
| OnInitializedAsyncCallback | EventCallback | Callback during OnInitializedAsync. |
| OnInitializedAsyncCallbackCompleted | EventCallback | Callback when OnInitializedAsync completes. |
| OnIsComponentLoadingChanged | EventCallback<bool> | Callback when IsComponentLoading changes. |
| OnCurrentRenderModeChanged | EventCallback<DwsRenderMode> | Callback when CurrentRenderMode changes. |
| OnComponentStateChanged | EventCallback<DwsComponentStateType> | Callback when ComponentState changes. |
