Scroll Area
Constrain the height of long content.
Examples
Constrain the height of long content
- Confirm data contracts
- Review keyboard navigation
- Verify error states
- Test permissions
- Publish notes
- Monitor the release
React code
import { ScrollArea } from "@accelerate/react/components";
import type { CSSProperties } from "react";
export function Example() {
return (
<>
<ScrollArea role="region" aria-label="Release checklist" style={{ "--acc-scroll-height": "6rem" } as CSSProperties}>
<ol>
<li>Confirm data contracts</li>
<li>Review keyboard navigation</li>
<li>Verify error states</li>
<li>Test permissions</li>
<li>Publish notes</li>
<li>Monitor the release</li>
</ol>
</ScrollArea>
</>
);
}Angular code
import { Component } from "@angular/core";
import { AccScrollArea } from "@accelerate/angular/components";
@Component({
selector: "app-example",
imports: [
AccScrollArea,
],
template: `
<div accScrollArea role="region" aria-label="Release checklist" style="--acc-scroll-height: 6rem">
<ol>
<li>Confirm data contracts</li>
<li>Review keyboard navigation</li>
<li>Verify error states</li>
<li>Test permissions</li>
<li>Publish notes</li>
<li>Monitor the release</li>
</ol>
</div>
`,
})
export class Example {}Installation
Source preview. The expanded component catalog is ahead of the public npm releases. To run these examples in your own application, use packages built from the SDK source used for the previews or a release that includes the APIs below.
- React
@accelerate/ui@0.4.0and@accelerate/react@0.4.0- Angular
@accelerate/ui@0.4.0and@accelerate/angular@0.2.0
Load @accelerate/ui/theme.css and put acc-theme on the app or the region using Accelerator components. See the framework setup guide for the theme and adapter conventions.
Usage
Label the region and set --acc-scroll-height to customize the maximum block size.
Import the React component ScrollArea from @accelerate/react/components. For Angular, add AccScrollArea to the standalone component’s imports and use <div accScrollArea>.
Examples use these React parts: ScrollArea. The Angular examples show the corresponding directives and template hosts.
API reference
- --acc-scroll-height
- Sets the maximum block size.
- tabindex
- Defaults to 0 to make the region keyboard reachable.