8cadd00d34
Created by Github action --------- Co-authored-by: Crowdin Bot <support+bot@crowdin.com> Co-authored-by: github-actions <github-actions@twenty.com>
489 lines
20 KiB
Plaintext
489 lines
20 KiB
Plaintext
---
|
|
title: Knappar
|
|
image: /images/user-guide/views/filter.png
|
|
---
|
|
|
|
<Frame>
|
|
<img src="/images/user-guide/views/filter.png" alt="Header" />
|
|
</Frame>
|
|
|
|
En lista över knappar och grupper av knappar som används i appen.
|
|
|
|
## Knapp
|
|
|
|
<Tabs>
|
|
|
|
<Tab title="Usage">
|
|
|
|
```jsx
|
|
import { Button } from "@/ui/input/button/components/Button";
|
|
|
|
export const MyComponent = () => {
|
|
return (
|
|
<Button
|
|
className
|
|
Icon={null}
|
|
title="Title"
|
|
fullWidth={false}
|
|
variant="primary"
|
|
size="medium"
|
|
position="standalone"
|
|
accent="default"
|
|
soon={false}
|
|
disabled={false}
|
|
focus={true}
|
|
onClick={() => console.log("click")}
|
|
/>
|
|
);
|
|
};
|
|
```
|
|
|
|
</Tab>
|
|
|
|
<Tab title="Props">
|
|
|
|
| Egenskaper | Typ | Beskrivning |
|
|
| ----------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| className | string | Valfritt klassnamn för ytterligare styling |
|
|
| Ikon | `React.ComponentType` | En valfri ikonkomponent som visas i knappen |
|
|
| titel | string | Textinnehållet i knappen |
|
|
| fullWidth | boolean | Definierar om knappen ska täcka hela bredden av sin behållare |
|
|
| variant | string | Den visuella stilvarianten för knappen. Alternativ inkluderar `primär`, `sekundär` och `tertiär` |
|
|
| storlek | string | Knappens storlek. Har två alternativ: `liten` och `mellan` |
|
|
| position | string | Knappens placering i förhållande till sina syskon. Alternativ inkluderar: `fristående`, `vänster`, `höger`, och `mitt` |
|
|
| accent | string | Accentfärgen på knappen. Options include: `default`, `blue`, and `danger` |
|
|
| snart | boolean | Indikerar om knappen är markerad som "snart" (t.ex. för kommande funktioner) |
|
|
| inaktiverad | boolean | Ange om knappen är inaktiverad eller inte |
|
|
| fokus | boolean | Avgör om knappen är i fokus |
|
|
| onClick | funktion | En callback-funktion som utlöses när användaren klickar på knappen |
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
## Button Group
|
|
|
|
<Tabs>
|
|
<Tab title="Usage">
|
|
```jsx
|
|
import { Button } from "@/ui/input/button/components/Button";
|
|
import { ButtonGroup } from "@/ui/input/button/components/ButtonGroup";
|
|
|
|
export const MyComponent = () => {
|
|
return ( <ButtonGroup variant="primary" size="large" accent="blue" className>
|
|
<Button
|
|
className
|
|
Icon={null}
|
|
title="Button 1"
|
|
fullWidth={false}
|
|
variant="primary"
|
|
size="medium"
|
|
position="standalone"
|
|
accent="blue"
|
|
soon={false}
|
|
disabled={false}
|
|
focus={false}
|
|
onClick={() => console.log("click")}
|
|
/>
|
|
<Button
|
|
className
|
|
Icon={null}
|
|
title="Button 2"
|
|
fullWidth={false}
|
|
variant="secondary"
|
|
size="medium"
|
|
position="left"
|
|
accent="blue"
|
|
soon={false}
|
|
disabled={false}
|
|
focus={false}
|
|
onClick={() => console.log("click")}
|
|
/>
|
|
<Button
|
|
className
|
|
Icon={null}
|
|
title="Button 3"
|
|
fullWidth={false}
|
|
variant="tertiary"
|
|
size="medium"
|
|
position="right"
|
|
accent="blue"
|
|
soon={false}
|
|
disabled={false}
|
|
focus={false}
|
|
onClick={() => console.log("click")}
|
|
/> </ButtonGroup>
|
|
);
|
|
};
|
|
|
|
````
|
|
</Tab>
|
|
|
|
<Tab title="Props">
|
|
|
|
|
|
| Props | Type | Description |
|
|
|-------|------|-------------|
|
|
| variant | string | The visual style variant of the buttons within the group. Options include `primary`, `secondary`, and `tertiary` |
|
|
| size | string | The size of the buttons within the group. Has two options: `medium` and `small` |
|
|
| accent | string | The accent color of the buttons within the group. Options include `default`, `blue` and `danger` |
|
|
| className | string | Optional class name for additional styling |
|
|
| children | ReactNode | An array of React elements representing the individual buttons within the group |
|
|
|
|
|
|
|
|
</Tab>
|
|
</Tabs>
|
|
|
|
|
|
## Floating Button
|
|
|
|
<Tabs>
|
|
<Tab title="Usage">
|
|
|
|
```jsx
|
|
import { FloatingButton } from "@/ui/input/button/components/FloatingButton";
|
|
import { IconSearch } from "@tabler/icons-react";
|
|
|
|
export const MyComponent = () => {
|
|
return (
|
|
<FloatingButton
|
|
className
|
|
Icon={IconSearch}
|
|
title="Title"
|
|
size="medium"
|
|
position="standalone"
|
|
applyShadow={true}
|
|
applyBlur={true}
|
|
disabled={false}
|
|
focus={true}
|
|
/>
|
|
);
|
|
};
|
|
````
|
|
|
|
</Tab>
|
|
|
|
<Tab title="Props">
|
|
|
|
| Egenskaper | Typ | Beskrivning |
|
|
| ----------- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
| klassNamn | string | Valfritt namn för ytterligare styling |
|
|
| Ikon | `React.ComponentType` | En valfri ikonkomponent som visas i knappen |
|
|
| titel | string | Textinnehållet i knappen |
|
|
| storlek | string | Knappens storlek. Har två alternativ: `liten` och `mellan` |
|
|
| position | string | Knappens placering i förhållande till sina syskon. Alternativ inkluderar: `fristående`, `vänster`, `mitt`, `höger` |
|
|
| applyShadow | boolean | Avgör om skugga ska appliceras på en knapp |
|
|
| applyBlur | boolean | Avgör om en oskärpa ska appliceras på knappen |
|
|
| inaktiverad | boolean | Avgör om knappen är inaktiverad |
|
|
| fokus | boolean | Indikerar om knappen är i fokus |
|
|
|
|
</Tab>
|
|
</Tabs>
|
|
|
|
## Floating Button Group
|
|
|
|
<Tabs>
|
|
<Tab title="Usage">
|
|
|
|
```jsx
|
|
import { FloatingButton } from "@/ui/input/button/components/FloatingButton";
|
|
import { FloatingButtonGroup } from "@/ui/input/button/components/FloatingButtonGroup";
|
|
import { IconClipboardText, IconCheckbox } from "@tabler/icons-react";
|
|
|
|
export const MyComponent = () => {
|
|
return (
|
|
<FloatingButtonGroup size="small">
|
|
<FloatingButton
|
|
className
|
|
Icon={IconClipboardText}
|
|
title
|
|
size="small"
|
|
position="standalone"
|
|
applyShadow={true}
|
|
applyBlur={true}
|
|
disabled={false}
|
|
focus={true}
|
|
/>
|
|
<FloatingButton
|
|
className
|
|
Icon={IconCheckbox}
|
|
title
|
|
size="small"
|
|
position="standalone"
|
|
applyShadow={true}
|
|
applyBlur={true}
|
|
disabled={false}
|
|
/>
|
|
</FloatingButtonGroup>
|
|
);
|
|
};
|
|
```
|
|
|
|
</Tab>
|
|
|
|
<Tab title="Props">
|
|
|
|
| Egenskaper | Typ | Beskrivning | Standard |
|
|
| ---------- | --------- | ------------------------------------------------------------------------------------------ | -------- |
|
|
| storlek | string | Knappens storlek. Har två alternativ: `liten` och `mellan` | small |
|
|
| barn | ReactNode | En array av React-element som representerar de individuella knapparna i gruppen | |
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
## Flytande Ikonknapp
|
|
|
|
<Tabs>
|
|
<Tab title="Usage">
|
|
|
|
```jsx
|
|
import { FloatingIconButton } from "@/ui/input/button/components/FloatingIconButton";
|
|
import { IconSearch } from "@tabler/icons-react";
|
|
|
|
export const MyComponent = () => {
|
|
return (
|
|
<FloatingIconButton
|
|
className
|
|
Icon={IconSearch}
|
|
size="small"
|
|
position="standalone"
|
|
applyShadow={true}
|
|
applyBlur={true}
|
|
disabled={false}
|
|
focus={false}
|
|
onClick={() => console.log("click")}
|
|
isActive={true}
|
|
/>
|
|
);
|
|
};
|
|
```
|
|
|
|
</Tab>
|
|
|
|
<Tab title="Props">
|
|
|
|
| Egenskaper | Typ | Beskrivning |
|
|
| ----------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
| klassNamn | string | Valfritt namn för ytterligare styling |
|
|
| Ikon | `React.ComponentType` | En valfri ikonkomponent som visas i knappen |
|
|
| storlek | string | Knappens storlek. Har två alternativ: `liten` och `mellan` |
|
|
| position | string | Knappens placering i förhållande till sina syskon. Alternativ inkluderar: `fristående`, `vänster`, `höger`, och `mitt` |
|
|
| applyShadow | boolean | Avgör om skugga ska appliceras på en knapp |
|
|
| applyBlur | boolean | Avgör om en oskärpa ska appliceras på knappen |
|
|
| inaktiverad | boolean | Avgör om knappen är inaktiverad |
|
|
| fokus | boolean | Indikerar om knappen är i fokus |
|
|
| onClick | funktion | En callback-funktion som utlöses när användaren klickar på knappen |
|
|
| isActive | boolean | Avgör om knappen är i ett aktivt tillstånd |
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
## Floating Icon Button Group
|
|
|
|
<Tabs>
|
|
<Tab title="Usage">
|
|
|
|
```jsx
|
|
import { FloatingIconButtonGroup } from "@/ui/input/button/components/FloatingIconButtonGroup";
|
|
import { IconClipboardText, IconCheckbox } from "@tabler/icons-react";
|
|
|
|
export const MyComponent = () => {
|
|
const iconButtons = [
|
|
{
|
|
Icon: IconClipboardText,
|
|
onClick: () => console.log("Button 1 clicked"),
|
|
isActive: true,
|
|
},
|
|
{
|
|
Icon: IconCheckbox,
|
|
onClick: () => console.log("Button 2 clicked"),
|
|
isActive: true,
|
|
},
|
|
];
|
|
|
|
return (
|
|
<FloatingIconButtonGroup
|
|
className
|
|
size="small"
|
|
iconButtons={iconButtons} />
|
|
);
|
|
};
|
|
|
|
```
|
|
|
|
</Tab>
|
|
|
|
<Tab title="Props">
|
|
|
|
| Egenskaper | Typ | Beskrivning |
|
|
| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
| className | string | Valfritt namn för ytterligare styling |
|
|
| storlek | string | Knappens storlek. Har två alternativ: `liten` och `mellan` |
|
|
| ikonerKnappar | array | En array av objekt, vardera representerar en ikonknapp i gruppen. Varje objekt ska innehålla den ikonkomponent som du vill visa i knappen, den funktion som ska anropas när en användare klickar på knappen och om knappen ska vara aktiv eller inte. |
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
## Light Button
|
|
|
|
<Tabs>
|
|
<Tab title="Usage">
|
|
|
|
```jsx
|
|
import { LightButton } from "@/ui/input/button/components/LightButton";
|
|
|
|
export const MyComponent = () => {
|
|
return <LightButton
|
|
className
|
|
icon={null}
|
|
title="Title"
|
|
accent="secondary"
|
|
active={false}
|
|
disabled={false}
|
|
focus={true}
|
|
onClick={()=>console.log('click')}
|
|
/>;
|
|
};
|
|
```
|
|
|
|
</Tab>
|
|
|
|
<Tab title="Props">
|
|
|
|
| Egenskaper | Typ | Beskrivning |
|
|
| ----------- | ----------------- | -------------------------------------------------------------------------------------------------------- |
|
|
| className | string | Valfritt namn för ytterligare styling |
|
|
| ikon | `React.ReactNode` | Ikonen du vill visa i knappen |
|
|
| titel | string | Textinnehållet i knappen |
|
|
| accent | string | Accentfärgen på knappen. Alternativ inkluderar: `sekundär` och `tertiär` |
|
|
| aktiv | boolean | Avgör om knappen är i ett aktivt tillstånd |
|
|
| inaktiverad | boolean | Avgör om knappen är inaktiverad |
|
|
| fokus | boolean | Indikerar om knappen är i fokus |
|
|
| onClick | funktion | En callback-funktion som utlöses när användaren klickar på knappen |
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
## Light Icon Button
|
|
|
|
<Tabs>
|
|
<Tab title="Usage">
|
|
|
|
```jsx
|
|
import { LightIconButton } from "@/ui/input/button/components/LightIconButton";
|
|
import { IconSearch } from "@tabler/icons-react";
|
|
|
|
export const MyComponent = () => {
|
|
return (
|
|
<LightIconButton
|
|
className
|
|
testId="test1"
|
|
Icon={IconSearch}
|
|
title="Title"
|
|
size="small"
|
|
accent="secondary"
|
|
active={true}
|
|
disabled={false}
|
|
focus={true}
|
|
onClick={() => console.log("click")}
|
|
/>
|
|
);
|
|
};
|
|
```
|
|
|
|
</Tab>
|
|
|
|
<Tab title="Props">
|
|
|
|
| Egenskaper | Typ | Beskrivning |
|
|
| ----------- | --------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
| className | string | Valfritt namn för ytterligare styling |
|
|
| testId | string | Testidentifierare för knappen |
|
|
| Ikon | `React.ComponentType` | En valfri ikonkomponent som visas i knappen |
|
|
| titel | string | Textinnehållet i knappen |
|
|
| storlek | string | Knappens storlek. Har två alternativ: `liten` och `mellan` |
|
|
| accent | string | Accentfärgen på knappen. Alternativ inkluderar: `sekundär` och `tertiär` |
|
|
| aktiv | boolean | Avgör om knappen är i ett aktivt tillstånd |
|
|
| inaktiverad | boolean | Avgör om knappen är inaktiverad |
|
|
| fokus | boolean | Indikerar om knappen är i fokus |
|
|
| onClick | funktion | En callback-funktion som utlöses när användaren klickar på knappen |
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
## Huvudknapp
|
|
|
|
<Tabs>
|
|
<Tab title="Usage">
|
|
|
|
```jsx
|
|
import { MainButton } from "@/ui/input/button/components/MainButton";
|
|
import { IconCheckbox } from "@tabler/icons-react";
|
|
|
|
export const MyComponent = () => {
|
|
return (
|
|
<MainButton
|
|
title="Checkbox"
|
|
fullWidth={false}
|
|
variant="primary"
|
|
soon={false}
|
|
Icon={IconCheckbox}
|
|
/>
|
|
);
|
|
};
|
|
```
|
|
|
|
</Tab>
|
|
|
|
<Tab title="Props">
|
|
|
|
| Egenskaper | Typ | Beskrivning |
|
|
| ------------------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
| titel | string | Textinnehållet i knappen |
|
|
| fullWidth | boolean | Definierar om knappen ska täcka hela bredden av sin behållare |
|
|
| variant | string | Den visuella stilvarianten för knappen. Alternativ inkluderar `primär` och `sekundär` |
|
|
| snart | boolean | Indikerar om knappen är markerad som "snart" (t.ex. för kommande funktioner) |
|
|
| Ikon | `React.ComponentType` | En valfri ikonkomponent som visas i knappen |
|
|
| React `button` egenskaper | `React.ComponentProps<'button'>` | Alla standard HTML-knapp egenskaper stöds |
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|
|
|
|
## Rundad Ikonknapp
|
|
|
|
<Tabs>
|
|
<Tab title="Usage">
|
|
|
|
```jsx
|
|
import { RoundedIconButton } from "@/ui/input/button/components/RoundedIconButton";
|
|
import { IconSearch } from "@tabler/icons-react";
|
|
|
|
export const MyComponent = () => {
|
|
return (
|
|
<RoundedIconButton
|
|
Icon={IconSearch}
|
|
/>
|
|
);
|
|
};
|
|
```
|
|
|
|
</Tab>
|
|
|
|
<Tab title="Props">
|
|
|
|
| Egenskaper | Typ | Beskrivning |
|
|
| ------------------------- | ----------------------------------------------- | ----------- |
|
|
| Ikon | `React.ComponentType` | |
|
|
| React `button` egenskaper | `React.ButtonHTMLAttributes<HTMLButtonElement>` | |
|
|
|
|
</Tab>
|
|
|
|
</Tabs>
|