“Kanji” Designer Card
Discover and reveal text over imageby Read Write Tools
|The rwt-kanji web component displays a designer card which has a horizontal title, a vertically transformed subtitle, text that is formatted as a blockquote, and an image with a mouse-over explanation.|
The rwt-kanji web component is intended for use on web pages where the reader's attention is only lightly engaged.
Sometimes a reader is in
scan mode, rather than comprehension mode. They are sniffing for the scent of things. When that's the case, this component can be used to present a complex idea as a simple visualization.
When a user's interest is piqued, more information can be revealed to the reader by hovering the mouse over the card's prominently displayed image. The extra information fades in, revealing itself on top of the image.
This component takes its name from its original use case: describing the inspiration behind the logos used in the desktop apps of Read Write Tools.
The rwt-kanji web component works in any browser that supports modern W3C standards. Templates are written using BLUEPHRASE notation, which can be compiled into HTML using the free Read Write View desktop app. It has no other prerequisites. Distribution and installation are done with either NPM or via Github.
Installation using NPM
If you are familiar with Node.js and the
package.json file, you'll be comfortable installing the component just using this command:
npm install rwt-kanji
If you are a front-end Web developer with no prior experience with NPM, follow these general steps:
- Install Node.js/NPM on your development computer.
- Create a
package.jsonfile in the root of your web project using the command:
npm install rwt-kanji
Important note: This web component uses Node.js and NPM and
package.json as a convenient distribution and installation mechanism. The web component itself does not need them.
Installation using Github
If you are more comfortable using Github for installation, follow these steps:
- Create a directory
node_modulesin the root of your web project.
- Clone the rwt-kanji web component into it using the command:
git clone https://github.com/readwritetools/rwt-kanji.git
Using the web component
After installation, you need to add two things to your HTML page to make use of it.
- Add a
scripttag to load the component's
<script src='/node_modules/rwt-kanji/rwt-kanji.js' type=module></script>
span slot=main-titleThe main title will be display horizontally across the top of the card in a sans-serif font. Maximum length is approximately 25 characters.
span slot=side-titleThe side title will be rotated and displayed vertically along the left-hand edge of the card in a sans-serif font. Maximum length is approximately 25 characters.
span slot=sloganA sentence that will be placed in the top half of the card. It will be captioned with quotation marks. Use <br> to break the sentence into multiple lines if desired.
span slot=image-textA sentence that will be hidden from the user until the mouse is hovered over the image.
img slot=image src=URLAn image that should be square, ideally about 200 by 200 pixels.
Here's an example:
<span slot=main-title>READ WRITE VIEW</span>
<span slot=side-title>PLAIN TEXT</span>
<span slot=slogan>Plain text reader.<br />Hypertext Markup writer.</span>
<span slot=image-text>The Japanese kanji 見 (mi) is used in words meaning seeing, looking at, and viewing. RWVIEW has adopted 見 as its logo.</span>
<img slot=image src='https://readwritetools.com/img/embossed/rwview-embossed.png' />
Designer card size
The designer card is square by default. Its size may be overridden using CSS by defining new values for
--font-basis to shrink or grow the entire card.
--width: calc(22rem * var(--font-basis));
--height: calc(22rem * var(--font-basis));
--sidebar-width: calc(2rem * var(--font-basis));
--title-height: calc(2rem * var(--font-basis));
Dialog color scheme
The default color palette for the dialog uses a dark mode theme. You can use CSS to override the variables' defaults:
The rwt-kanji web component is licensed under the MIT License.
Copyright © 2020 Read Write Tools.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|Documentation||Read Write Hub|