docs: create-and-check-documentation
This commit is contained in:
committed by
Gerla, J. (Justin)
parent
f87c7fed03
commit
10a2c0c3cd
@@ -1,9 +1,17 @@
|
||||
import {useEffect, useRef} from "react";
|
||||
|
||||
/**
|
||||
* An element that always scrolls into view when it is rendered. When added to a list, the entire list will scroll to show this element.
|
||||
* A React component that automatically scrolls itself into view whenever rendered.
|
||||
*
|
||||
* This component is especially useful in scrollable containers to keep the most
|
||||
* recent content visible (e.g., chat applications, live logs, or notifications).
|
||||
*
|
||||
* It uses the browser's `Element.scrollIntoView()` API with smooth scrolling behavior.
|
||||
*
|
||||
* @returns A `<div>` element that scrolls into view when mounted or updated.
|
||||
*/
|
||||
export default function ScrollIntoView() {
|
||||
/** Ref to the DOM element that will be scrolled into view. */
|
||||
const elementRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user