@buun_group/brutalist-ui
Version:
A brutalist-styled component library
99 lines (98 loc) • 3.2 kB
TypeScript
/**
* @module TableOfContents
* @description A navigational component that displays a hierarchical list of page sections with support for active states and multiple positioning options. Perfect for documentation and long-form content.
*/
import React, { HTMLAttributes, CSSProperties } from 'react';
/**
* Props for the main TableOfContents component
*/
export interface TableOfContentsProps extends HTMLAttributes<HTMLElement> {
/**
* Title text displayed at the top of the table of contents
* @default 'Table of Contents'
*/
title?: string;
/**
* Whether to display the title header
* @default true
*/
showTitle?: boolean;
/**
* Size variant affecting spacing and typography
* @default 'md'
*/
size?: 'sm' | 'md' | 'lg';
/**
* Positioning behavior of the table of contents
* @default 'default'
*/
position?: 'default' | 'sticky' | 'floating';
/**
* Additional CSS classes to apply to the component
*/
className?: string;
/**
* Custom inline styles (supports utility classes)
*/
style?: CSSProperties;
}
/**
* Props for the TableOfContentsList component
*/
export interface TableOfContentsListProps extends HTMLAttributes<HTMLOListElement> {
/**
* Additional CSS classes to apply to the ordered list
*/
className?: string;
}
/**
* Props for the TableOfContentsItem component
*/
export interface TableOfContentsItemProps extends HTMLAttributes<HTMLLIElement> {
/**
* Heading level for proper indentation and styling
* @default 1
*/
level?: 1 | 2 | 3 | 4 | 5 | 6;
/**
* Whether this item represents the currently active section
* @default false
*/
isActive?: boolean;
/**
* Additional CSS classes to apply to the list item
*/
className?: string;
}
/**
* Props for the TableOfContentsLink component
*/
export interface TableOfContentsLinkProps extends HTMLAttributes<HTMLAnchorElement> {
/**
* URL or anchor link that the item should navigate to
*/
href: string;
/**
* Whether this link represents the currently active section
* @default false
*/
isActive?: boolean;
/**
* Heading level for appropriate styling and indentation
* @default 1
*/
level?: 1 | 2 | 3 | 4 | 5 | 6;
/**
* Additional CSS classes to apply to the link element
*/
className?: string;
}
export interface TableOfContentsComponent extends React.ForwardRefExoticComponent<TableOfContentsProps & React.RefAttributes<HTMLElement>> {
List: typeof TableOfContentsList;
Item: typeof TableOfContentsItem;
Link: typeof TableOfContentsLink;
}
export declare const TableOfContents: TableOfContentsComponent;
export declare const TableOfContentsList: React.ForwardRefExoticComponent<TableOfContentsListProps & React.RefAttributes<HTMLOListElement>>;
export declare const TableOfContentsItem: React.ForwardRefExoticComponent<TableOfContentsItemProps & React.RefAttributes<HTMLLIElement>>;
export declare const TableOfContentsLink: React.ForwardRefExoticComponent<TableOfContentsLinkProps & React.RefAttributes<HTMLAnchorElement>>;