0.4.4 • Published 10 months ago
@suyongs/solid-utility v0.4.4
solid-utility
Utility component, hooks or anything else for Solid JS
Installation
- pnpm
pnpm add @suyongs/solid-utility- npm
npm install --save @suyongs/solid-utility- yarn
yarn add @suyongs/solid-utilityAPI
Transition
Transition: Vue3 like Transition componentname:[string], name of transitionappear:[boolean], whether transition should be applied on initial render, default isfalsemode:in-outout-in, default isin-outenterFromClass:[string], class name of enter from, default isenter-fromenterActiveClass:[string], class name of enter active, default isenter-activeenterToClass:[string], class name of enter to, default isenter-toleaveFromClass:[string], class name of leave from, default isleave-fromleaveActiveClass:[string], class name of leave active, default isleave-activeleaveToClass:[string], class name of leave to, default isleave-toonBeforeEnter:[(el: HTMLElement) => void], callback before enteronEnter:[(el: HTMLElement) => void], callback when enteronAfterEnter:[(el: HTMLElement) => void], callback after enteronBeforeLeave:[(el: HTMLElement) => void], callback before leaveonLeave:[(el: HTMLElement) => void], callback when leaveonAfterLeave:[(el: HTMLElement) => void], callback after leave
import { Transition } from '@suyongs/solid-utility';
const Component = () => {
const [show, setShow] = createSignal(true);
return (
<Transition name={'fade'}>
<Show when={show()}>
<div>hello world</div>
</Show>
</Transition>
)
};Marquee
Marquee: alternative for marquee tag- Normal Property
speed:[number], move speed of marquee. pixel per seconds, default is70gap:[number], gap between two marquee, default is0direction:leftrightupdown, default isleftmode:[auto | scroll | truncate | hover | force-hover]default isauto'auto: contents are scrolled when overflow its parentscrollmode always scrolledtruncatemode will truncate the content when overflowhovermode will scroll when hoverforce-hovermode will scroll when hovered, even if it's not overflow
autoUpdate:[boolean], whether marquee should update automatically, default istrue
- Headless Property
component:Component, marquee can be any component, default isdivslots:{ first: Component; second: Component }set internal component, default is same ascomponentslotProps:{ first: Props; second: Props }internal component's propertiesref:MarqueeRef, ref of marquee. It hasupdateOverflowmethod to update overflow status
- Normal Property
import { Marquee } from '@suyongs/solid-utility';
const Component = () => {
return (
<Marquee component={'a'} href={'https://github.com'}>
if you want to make this marquee 'a' tag, you should set component as 'a'
<span>
Also, you can set any components as marquee's children
</span>
</Marquee>
);
};