k8ordo
  • UI
  • Form
  • State
  • Router
  • Static
  • Server
  • i18n
  • Color scheme
Switch to dark mode
  • Get Started
  • Theming
  • i18n
  • Components
  • AI
Open navigation
Buttons
  • Button
  • IconButton
Navigation
  • Anchor
  • Tabs
  • Breadcrumb
  • Pagination
Forms
  • TextField
  • Textarea
  • NumberField
  • Select
  • Checkbox
  • CheckboxCard
  • CheckboxGroup
  • Switch
  • PasswordInput
  • Radio
  • RadioCard
  • Autocomplete
  • Slider
  • FileField
  • FormControl
  • Form
Data Display
  • Accordion
  • Avatar
  • Badge
  • Card
  • Code
  • Table
  • Heading
Feedback
  • Alert
  • Skeleton
  • Spinner
  • Toast
  • Progress
Overlays
  • Dialog
  • Drawer
  • Modal
  • Popover
  • DropdownMenu
  • Tooltip
  • ListBox
Layout
  • Stack
  • Grid
  • Separator
  • ScrollLinked
Observers
  • InView
  • Resize
Media
  • Icons
k8ordo

React libraries that use Baseline features without holding back.

Packages
  • @k8ordo/ui
  • @k8ordo/form
  • @k8ordo/state
  • @k8ordo/router
  • @k8ordo/static
  • @k8ordo/server
  • @k8ordo/i18n
  • @k8ordo/color-scheme
UI
  • Get Started
  • Theming
  • i18n
  • Components
  • AI Chat
  • Generative UI
  • AI Agents
  • Storybook
Resources
  • GitHub
  • npm

© 2026 k8o — MIT License

Typeset in Noto Sans JP & M PLUS 2

Components

Buttons
  • Button
  • IconButton
Navigation
  • Anchor
  • Tabs
  • Breadcrumb
  • Pagination
Forms
  • TextField
  • Textarea
  • NumberField
  • Select
  • Checkbox
  • CheckboxCard
  • CheckboxGroup
  • Switch
  • PasswordInput
  • Radio
  • RadioCard
  • Autocomplete
  • Slider
  • FileField
  • FormControl
  • Form
Data Display
  • Accordion
  • Avatar
  • Badge
  • Card
  • Code
  • Table
  • Heading
Feedback
  • Alert
  • Skeleton
  • Spinner
  • Toast
  • Progress
Overlays
  • Dialog
  • Drawer
  • Modal
  • Popover
  • DropdownMenu
  • Tooltip
  • ListBox
Layout
  • Stack
  • Grid
  • Separator
  • ScrollLinked
Observers
  • InView
  • Resize
Media
  • Icons

InView

Reports whether its children are inside the viewport or a scroll container.

View in Storybook

Import

Usage

Basic Usage

Out of view

Scroll down.

Target

Once

With once, observation stops the first time the children are in view, and leaving afterwards reports nothing.

Not seen yet

Scroll down, then back up. The badge stays.

Target

Multiple Children

With several elements, it is true while any of them is in view, and it follows elements that mount or unmount later. While there is nothing to observe it is false.

Props

children
Type: ReactNode
Default: -
onChange
Type: (isInView: boolean) => void
Default: -
once?
Type: boolean
Default: false
root?
Type: Element|null
Default: null
rootMargin?
Type: string
Default: '0px'
threshold?
Type: number
Default: 0
PropTypeDefault
childrenReactNode-
onChange(isInView: boolean) => void-
once?booleanfalse
root?Element|nullnull
rootMargin?string'0px'
threshold?number0
import { InView } from '@k8ordo/ui';
const [container, setContainer] = useState<HTMLElement | null>(null);
const [isInView, setIsInView] = useState(false);

<div ref={setContainer} className="h-48 overflow-y-auto">
  <InView onChange={setIsInView} root={container}>
    <p>Target</p>
  </InView>
</div>
<InView once onChange={setHasBeenSeen} root={container}>
  <p>Target</p>
</InView>