
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@nine-slice-frame/react
Advanced tools
Nine-slice scaling component for React using CSS border-image.
Nine-slice scaling divides an image into 9 sections, allowing it to scale to any size while preserving corner details and preventing distortion. Perfect for UI frames, borders, panels, and buttons that need to scale dynamically.
┌─────────┬───────────┬─────────┐
│ Corner │ Top Edge │ Corner │
│ (Fixed) │ (Scale H) │ (Fixed) │
├─────────┼───────────┼─────────┤
│ Left │ Center │ Right │
│ Edge │ (Scale │ Edge │
│(Scale V)│ Both) │(Scale V)│
├─────────┼───────────┼─────────┤
│ Corner │ Bottom │ Corner │
│ (Fixed) │ Edge │ (Fixed) │
└─────────┴───────────┴─────────┘
The Problem: Traditional image scaling stretches the entire image uniformly, distorting corners, borders, and decorative elements. This makes UI elements look unprofessional and breaks visual consistency.
The Solution: Nine-slice scaling keeps corners and edges crisp while only stretching the middle sections. This means:
border-image, no canvas or WebGL overheadCommon Use Cases:
Zero Dependencies - No runtime dependencies beyond React. This package only requires React as a peer dependency.
Incredibly Small - Minimal bundle impact: ~881B (ESM)
Native Performance - Uses browser-native CSS border-image property, not canvas rendering or heavy image manipulation libraries. Fast, efficient, and hardware-accelerated.
Framework-Agnostic API - Same simple, consistent API across all frameworks:
npm install @nine-slice-frame/react
# or
pnpm add @nine-slice-frame/react
# or
yarn add @nine-slice-frame/react
import { NineSliceFrame } from '@nine-slice-frame/react';
function App() {
return (
<NineSliceFrame
imagePath="/ui/frame.png"
slice={7}
borderWidth={5}
repeat="stretch"
fill={true}
pixelated={true}
>
<p>Your content here</p>
</NineSliceFrame>
);
}
| Prop | Type | Default | Description |
|---|---|---|---|
imagePath | string | required | Path to the image (relative to public folder) |
slice | number | object | 8 | Slice values - number for uniform, or { top, right, bottom, left } for per-edge |
borderWidth | number | 5 | Visual border width in pixels |
repeat | 'stretch' | 'repeat' | 'round' | 'space' | 'stretch' | Border repeat mode |
fill | boolean | true | Use 'fill' to show center of image as background |
pixelated | boolean | true | Use pixelated rendering for pixel art |
className | string | '' | Additional CSS class names |
style | React.CSSProperties | {} | Additional inline styles |
<NineSliceFrame
imagePath="/ui/fancy-frame.png"
slice={{ top: 10, right: 8, bottom: 10, left: 8 }}
borderWidth={6}
>
Content with asymmetric border
</NineSliceFrame>
<NineSliceFrame
imagePath="/ui/frame.png"
slice={8}
borderWidth={10}
className="my-custom-frame"
style={{ padding: '20px', minHeight: '200px' }}
>
Styled content
</NineSliceFrame>
This package includes TypeScript definitions out of the box.
MIT © Callum Gander
FAQs
Nine-slice scaling component for React using CSS border-image
We found that @nine-slice-frame/react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.