Skip to content

HttpMethod

The method of an HTTP request, in its colour and in words: GET, POST, DELETE.

import { HttpMethod } from '@sypnia/ui/react'

On this page
  1. Methods
  2. When to use it
  3. For everyone
  4. Props

Methods

Each method in its tone.

GETPOSTPUTPATCHDELETEOPTIONS
Code
import { HttpMethod } from '@sypnia/ui/react';

// Reading is calm, writing is green, changing is amber, deleting is red; the word is always there too.
export default function Methods() {
  return <div className="sy-row">{['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'].map((m) => <HttpMethod key={m} method={m} />)}</div>;
}

When to use it

Use it when

  • Lists of endpoints, requests in logs.

Do not use it when

  • It is not a request: Badge.

For everyone

  • The word is always there; colour only repeats it.

Props

HttpMethodTypeDefault
methodrequired string
  1. Methods
  2. When to use it
  3. For everyone
  4. Props

    Search pages, sections and terms