StatusCode
The status of an HTTP answer: the number in its tone, and its name on hover and for screen readers.
import { StatusCode } from '@sypnia/ui/react'
On this page
Status codes
2xx, 3xx, 4xx and 5xx.
200 OK201 Created304 Not Modified401 Unauthorized404 Not Found500 Internal Server Error
Code
import { StatusCode } from '@sypnia/ui/react';
// 2xx went well, 3xx points elsewhere, 4xx is the caller's mistake, 5xx is the server's. Hover for the name.
export default function Codes() {
return (
<div className="sy-row">
<StatusCode code={200} text="OK" /><StatusCode code={201} text="Created" /><StatusCode code={304} text="Not Modified" />
<StatusCode code={401} text="Unauthorized" /><StatusCode code={404} text="Not Found" /><StatusCode code={500} text="Internal Server Error" />
</div>
);
} When to use it
Use it when
- Requests in logs and tables.
Do not use it when
- It is the state of a thing, not an HTTP answer: Status or Badge.
For everyone
- Screen readers hear the number and its name: «404 Not Found».
Props
| StatusCode | Type | Default |
|---|---|---|
coderequired | number | |
text | string |