3.1.5 • Published 1 year ago

@highlight-ui/link v3.1.5

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

npm personio.design storybook.personio.design

@highlight-ui/link

Links are used for navigation, and usually appear standalone or at the end of a sentence.

Features

  • Link

    • standalone (depending on the provided href value the component will determine if the link should be external or internal and therefore either show or hide the icon)
    • inline
  • external-link icon is part of the <Link variant="standalone" /> and should be automatically shown depending on the href provided

Installation

Using npm:

npm install @highlight-ui/link

Using yarn:

yarn add @highlight-ui/link

Using pnpm:

pnpm install @highlight-ui/link

In your (S)CSS file:

@import url('@highlight-ui/link');

Once the package is installed, you can import the library:

import { Link } from '@highlight-ui/link';

Usage

standalone internal Link

import React, { useState } from 'react';
import { Link } from '@highlight-ui/link';

export default function LinkExample() {
  return <Link href="/settings">Settings</Link>;
}

standalone external Link

import React, { useState } from 'react';
import { Link } from '@highlight-ui/link';

export default function LinkExample() {
  return <Link href="http://personio.de">Personio</Link>;
}

inline Link

import React, { useState } from 'react';
import { Link } from '@highlight-ui/link';

export default function LinkExample() {
  return (
    <div>
      This is some inline text{' '}
      <Link href="/settings" variant="inline">
        this is the link
      </Link>{' '}
      this is text after the inline link
    </div>
  );
}

Props 📜

Link

All HTMLAnchorElement and PropsWithMetadata(https://gitlab.personio-internal.de/personio/platform/highlight-ui/-/blob/master/packages/utils/commons/src/types.ts#L24) props are accepted with this component. In addition to these, this component has the following props

PropTypeRequiredDefaultDescription
variant'inline', 'standalone'Nostandalonevariant of the link depending on how it is used

Accessibility ♿️

The Link component follows best practices for accessibility:

  • Uses a native <a> element to ensure proper keyboard navigation and focus handling

Testing

There are a number of unit tests covering the Link component, the snippets below can serve as a base to expand future testing if new behaviours are added.

The relevant render methods provide the option to add or override prop values.

Link

import React from 'react';
import { render } from '@testing-library/react';

import { Link, LinkProps } from '@highlight-ui/link';

describe('LinkTest', () => {
  const renderLink = (props: LinkProps) => {
    return render(<Link {...props} />);
  };

  it('test description', () => {
    renderLink({ href: '/test' });
    // write your expect here
  });
});

Place in design system 💻

The link component is an element of the design system and can be used across various services and contexts. It provides a consistent look and feel for user navigation.

Contributing 🖌️

Please visit personio.design for usage guidelines and visual examples.

If you're interested in contributing, please visit our contribution page.

3.1.5

1 year ago

3.1.4

1 year ago

3.1.3

2 years ago

3.0.12

2 years ago

3.0.13

2 years ago

3.0.10

2 years ago

3.0.11

2 years ago

3.0.16

2 years ago

3.0.17

2 years ago

3.0.14

2 years ago

3.0.15

2 years ago

3.1.0-r18.0

2 years ago

3.1.2

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.4

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.8

2 years ago

3.0.7

2 years ago

3.0.6

2 years ago

3.0.5

2 years ago

3.0.23

2 years ago

3.0.24

2 years ago

3.0.21

2 years ago

3.0.22

2 years ago

3.0.27

2 years ago

3.0.25

2 years ago

3.0.26

2 years ago

3.0.20

2 years ago

3.0.18

2 years ago

3.0.19

2 years ago

3.0.9

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.1.1

2 years ago

2.0.57

2 years ago

2.0.55

2 years ago

2.0.56

2 years ago

2.0.54

2 years ago

2.1.0

2 years ago

2.0.49

2 years ago

2.0.53

2 years ago

2.0.51

2 years ago

2.0.52

2 years ago

2.0.50

2 years ago

2.0.48

2 years ago

2.0.46

2 years ago

2.0.47

2 years ago

2.0.45

2 years ago

2.0.28

3 years ago

2.0.29

3 years ago

2.0.37

3 years ago

2.0.38

3 years ago

2.0.35

3 years ago

2.0.36

3 years ago

2.0.33

3 years ago

2.0.34

3 years ago

2.0.31

3 years ago

2.0.32

3 years ago

2.0.30

3 years ago

2.0.39

3 years ago

2.0.44

2 years ago

2.0.42

2 years ago

2.0.43

2 years ago

2.0.40

3 years ago

2.0.41

2 years ago

2.0.26

3 years ago

2.0.27

3 years ago

2.0.24

3 years ago

2.0.25

3 years ago

2.0.22

3 years ago

2.0.23

3 years ago

2.0.21

3 years ago

2.0.16

3 years ago

2.0.19

3 years ago

2.0.17

3 years ago

2.0.15

3 years ago

2.0.14

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.13

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.11

3 years ago

2.0.7

3 years ago

2.0.12

3 years ago

2.0.6

3 years ago

2.0.9

3 years ago

2.0.0-alpha.1

3 years ago

2.0.10

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

2.0.0-alpha.0

3 years ago

1.0.26

3 years ago

1.0.28

3 years ago

1.0.27

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.19

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.23

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.11

4 years ago

1.0.12

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago