metonym / svelte-link Goto Github PK
View Code? Open in Web Editor NEWLink component for Svelte
Home Page: https://metonym.github.io/svelte-link/
License: MIT License
Link component for Svelte
Home Page: https://metonym.github.io/svelte-link/
License: MIT License
Hey just a small feature request โ it would be great if the default for outbound
was a little smarter, and defaulted to true
if href
is an external URL, which the user can easily override with outbound={false}
to force all links to be same-target.
This would be especially useful if you don't have control over the href, for example in content from a CMS, where you want external links to automatically be outbound.
Happy to submit a PR if you're open to it
When importing svelte-link
into a typescript project, it gives the following error (at least in VS Code):
JSX element class does not support attributes because it does not have a '$$prop_def' property
Using the new SvelteComponentTyped
base class in Link.d.ts
fixes the issue, but not sure if this should be a PR here or against sveld
export default class Link extends SvelteComponentTyped<LinkProps> {}
A regular use-case for a generic Link
component is simply to add an .active
(most common) class for styling differences, indication of navigation, etc, rather than adding that logic to each link's implementation code.
If you added that automatic injection when a route prefix matches (for deep navigation) with an exact
modifier to force a full path match, that would be awesome...
<Link href="/about">About</Link>
<!-- when viewed at "/about/somewhere" should render: -->
<a href="/about" class="active">About</Link>
<Link href="/about" exact>About</Link>
<!-- when viewed at "/about/somewhere" should render: -->
<a href="/about">About</Link>
Just a suggestion!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.