
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
@slice-and-dice/govuk-react-top-nav
Advanced tools
Styled top navigation header with numerous constituent parts input as props.
import TopNav from '@govuk-react/top-nav';
TopNav with logo, service title and navigation items
import CrownIcon from '@govuk-react/icon-crown';
import SearchBox from '@govuk-react/search-box';
import TopNav, { asNavLinkAnchor, asTopNavAnchor } from '@govuk-react/top-nav';
const LogoAnchor = asTopNavAnchor('a');
const NavAnchor = asNavLinkAnchor('a');
const link = 'https://example.com?=1';
const Company = (
<LogoAnchor href={link} target="new">
<TopNav.IconTitle icon={<CrownIcon width="36" height="32" />}>GOV.UK</TopNav.IconTitle>
</LogoAnchor>
);
const ServiceTitle = (
<NavAnchor href={link} target="new">
Service Title
</NavAnchor>
);
const Search = (
<SearchBox placeholder="Search">hi</SearchBox>
);
<TopNav company={Company} serviceTitle={ServiceTitle} search={Search} active={0}>
<NavAnchor href="https://example.com?q=catdog" target="new">Navigation item #1</NavAnchor>
<NavAnchor href="https://example.com?q=dogcat" target="new">Navigation item #2</NavAnchor>
</TopNav>
import { BrowserRouter, Link } from 'react-router-dom';
import CrownIcon from '@govuk-react/icon-crown';
import TopNav, { asLogoAnchor, asNavLinkAnchor } from '@govuk-react/top-nav';
const LogoLink = asTopNavAnchor(Link);
const NavLink= asNavLinkAnchor(Link);
const reactRouterLink = '/section';
const CompanyLink = (
<LogoLink to={reactRouterLink}>
<TopNav.IconTitle icon={<CrownIcon width="36" height="32" />}>GOV.UK</TopNav.IconTitle>
</LogoLink>
);
const ServiceTitleLink = (
<NavLink to={reactRouterLink}>
Service Title
</NavLink>
);
<BrowserRouter>
<TopNav company={CompanyLink} serviceTitle={ServiceTitleLink} />
</BrowserRouter>
active
navigation itemsProp | Required | Default | Type | Description |
---|---|---|---|---|
bgColor | BLACK | string | Top nav background color | |
children | undefined | node | List Navigation items with anchor tags e.g. NavAnchor components | |
color | WHITE | string | Top nav text color | |
company | <IconTitle icon={<CrownIcon width="36" height="32" />}>GOV.UK</IconTitle> | node | Company component e.g. GOV UK | |
defaultOpen | false | bool | Is the mobile navigation open by default? | |
search | false | node | Search component | |
serviceTitle | undefined | node | Service title component e.g. Food Standards Authority |
FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.