Hopp til innhold

Ikoner

Vi bruker sjelden ikoner. De ikonene vi har valgt å ha, er funksjonelle, ikke til dekorasjon.

Kom i gang

Installer
npm i @fremtind/jkl-icons-react
Bruk
import { ArrowDown, ArrowHorizontalAnimated } from "@fremtind/jkl-icons-react";
// Importer stilark via JavaScript med CSS-loader.
import "@fremtind/jkl-icons/icons.min.css";
React
Versjon
Dokumentasjon
Readme
Changelog

Live demo

Ikonene våre
Egenskaper
Variant
Visning
Tema
Tetthet
const allIcons = [
CloseIcon,
CheckIcon,
MinusIcon,
PlusIcon,
SearchIcon,
HamburgerIcon,
CalendarIcon,
ArrowNorthEastIcon,
ArrowUpIcon,
ArrowDownIcon,
ArrowRightIcon,
ArrowLeftIcon,
ChevronDownIcon,
ChevronLeftIcon,
ChevronRightIcon,
ChevronUpIcon,
CopyIcon,
DotsIcon,
DragIcon,
GreenCheckIcon,
QuestionIcon,
RedCrossIcon,
InfoIcon,
ErrorIcon,
WarningIcon,
SuccessIcon,
LinkIcon,
TrashCanIcon,
];
const variant = 'medium';
const bold = false;
return (
<div
style={{
display: "grid",
gridTemplateColumns: "1fr 1fr 1fr 1fr",
columnGap: "1rem",
rowGap: "2rem",
width: "100%",
}}
>
{allIcons.map((Ico) => (
<div title={Ico.displayName} key={Ico.name}>
<Ico bold={bold} variant={variant} />
</div>
))}
</div>
);

Live demo

Animerte ikoner
Egenskaper
Variant
Visning
Tema
Tetthet
const AnimatedIcon = ({ renderIcon, iconName }) => {
const [state, setState] = React.useState(false);
return (
<>
<div title={iconName || renderIcon.name}>{renderIcon(state)}</div>
<div style={{ textAlign: "right" }}>
<button
data-density="compact"
className="jkl-button jkl-button--tertiary jkl-spacing-2xl--left"
onClick={() => setState(!state)}
>
Animér <span className="jkl-sr-only">{iconName}</span>
</button>
</div>
</>
);
};
const IconsExample = ({ choiceValues, boolValues }) => {
const variant = 'medium';
const bold = false;
return (
<div
style={{
display: "grid",
gridTemplateColumns: "1fr 1fr",
columnGap: "1rem",
rowGap: "2rem",
width: "100%",
}}
>
<AnimatedIcon
renderIcon={(isDown) => (
<ArrowVerticalAnimated
bold={bold}
pointingDown={isDown}
variant={variant}
/>
)}
iconName={ArrowVerticalAnimated.displayName}
/>
<AnimatedIcon
renderIcon={(isRight) => (
<ArrowHorizontalAnimated
bold={bold}
pointingRight={isRight}
variant={variant}
/>
)}
iconName={ArrowHorizontalAnimated.displayName}
/>
<AnimatedIcon
renderIcon={(isPlus) => (
<PlusRemoveAnimated bold={bold} isPlus={isPlus} variant={variant} />
)}
iconName={PlusRemoveAnimated.displayName}
/>
</div>
);
};
render(<IconsExample />);

React API

Her finner du en oversikt over props på komponentene i pakken.