@fortawesome/free-solid-svg-icons APIs
- faTimes
- faCheck
- faTrash
- faCog
- faInfoCircle
- faPlus
- faSearch
- faSpinner
- faArrowLeft
- faCopy
- faChevronDown
- faExclamationTriangle
- faUser
- faEdit
- faBars
- faHome
- faCheckCircle
- faExclamationCircle
- faQuestionCircle
- faPlay
- faTrashAlt
- faArrowRight
- faChevronRight
- faChevronUp
- fas
- faEye
- faSignOutAlt
- faLink
- faPen
- faSync
- faEyeSlash
- faStar
- faChevronLeft
- faLock
- faDownload
- faCaretDown
- faClock
- IconDefinition
- faEllipsisV
- faHeart
- faCode
- faAngleDown
- faTimesCircle
- faGlobe
- faFilter
- faSave
- faBell
- faList
- faSortDown
- faSortUp
- faUsers
- faArrowDown
- faArrowUp
- faPause
- faUndo
- faMoon
- faWindowMaximize
- faSyncAlt
- faExternalLinkAlt
- faAngleUp
- faAngleLeft
- faUpload
- faClipboard
- faBook
- faComments
- faSquare
- faCheckDouble
- faPlusCircle
- faComment
- faRandom
- faStop
- faFolderPlus
- faCamera
- faBan
- faEnvelope
- faGavel
- faPalette
- faPlane
- faTasks
- faPencilAlt
- faExchangeAlt
- faMapMarkerAlt
- faAngleRight
- faSun
- faMicrophone
- faMicrophoneSlash
- faVideo
- faVideoSlash
- faFile
- faLanguage
- faCogs
- faUserEdit
- faUserPlus
- faMinus
- faFolderOpen
- faCircleNotch
- faUserAlt
- faCodeBranch
- faCube
- faLaptopCode
- faMap
- faChartArea
- faHistory
- faShare
- faCloudDownloadAlt
- faFileUpload
- faCalendarAlt
- faLightbulb
- faPaperPlane
- faPaintBrush
- faExclamation
- faAnchor
- faBomb
- faMusic
- faCompress
- faExpand
- faRegistered
- faWifi
- faDrawPolygon
- faPhone
- faCommentDots
- faVolumeUp
- faCaretUp
- faBug
- faUserCircle
- faWallet
- faFileContract
- faTag
- faSearchPlus
- faSort
- faKey
- faVolumeMute
- faPowerOff
- faBolt
- faRedoAlt
- faSortAmountDown
- faCloudUploadAlt
- faShapes
- faSortAmountUp
- faTools
- faFileCode
- faRedo
- faAlignLeft
- faUserFriends
- faBookOpen
- faChartBar
- faFileExport
- faFileImport
- faSadCry
- faRocket
- faLinkSlash
- faTh
- faLongArrowAltRight
- faTags
- faDog
- faTv
- faCartPlus
- faMicrochip
- faNetworkWired
- faCommentSlash
- faAddressBook
- faCalendar
- faToggleOff
- faToggleOn
- faUserClock
- faHourglass
- faQuestion
- faStamp
- faAddressCard
- faPoo
- faAppleAlt
- faBible
- faBone
- faCar
- faCat
- faChess
- faSkull
- faFeatherAlt
- faFire
- faWindowMinimize
- faReplyAll
- faSignInAlt
- faBold
- faItalic
- faUnderline
- faHeading
- faQuoteRight
- faListOl
- faListUl
- faLevelDownAlt
- faLevelUpAlt
- faUndoAlt
- faPlug
- faBullhorn
- faPlaneDeparture
- faSimCard
- faBrush
- faAngleDoubleDown
- faCoins
- faCompressArrowsAlt
- faDiceD6
- faNewspaper
- faMinimize
- faUpRightFromSquare
- faCubes
- faRetweet
- faHandPeace
- faSpaceShuttle
- faXmark
- faFileAudio
- faStopwatch
- faDragon
- faSortNumericDown
- faSortNumericDownAlt
- faArrowUpRightFromSquare
- faArrowDown19
- faArrowDown91
- faHashtag
- faRepeat
- faLaptop
- faCloud
- faPiggyBank
- faRunning
- faBiking
- faBicycle
- faShareAlt
- faRuler
- faVial
- faUserTimes
- faUserMinus
- faCalendarDay
- faStepBackward
- faStepForward
- faDotCircle
- faUserLock
- faUserCog
- faTrophy
- faShareSquare
- faHandPointRight
- faChartLine
- faUserShield
- faCheckSquare
- faSortAmountDownAlt
- faIdCard
- faUserSlash
- faCalculator
- faEllipsisH
- faRulerCombined
- faSoap
- faMousePointer
- faHandRock
- faDroplet
- faThumbtack
- faReply
- faLayerGroup
- faMask
- faWindowRestore
- faThLarge
- faDesktop
- faInfo
- faHandsHelping
- faKeyboard
- faChartPie
- faColumns
- faTable
- faTachometerAlt
- faClipboardList
- faHammer
- faLockOpen
- faCity
- faChessRook
- faMountain
- faCampground
- faUniversity
- faCrosshairs
- faWrench
- faArrowCircleLeft
- faIdCardAlt
- faCreditCard
- faDollarSign
- faIdBadge
- faSlidersH
- faEuroSign
- faPoundSign
- faSearchDollar
- faPlayCircle
- faStream
- faFilm
- faSmile
- faPhoneAlt
- faArrowsAltV
- faUserAltSlash
- faLongArrowAltLeft
- faHdd
- faUnlink
- faInbox
- faMagic
- faImage
- faCalendarCheck
- faUserCheck
- faFolder
- faThermometerEmpty
- faCut
- faPaste
- faCircle
- faMobile
- faClipboardCheck
- faSortAlphaUp
- faSortAlphaDown
- faRss
- faPaw
Other Related APIs
- react#useCallback
- react#Suspense
- react#useContext
- react#useMemo
- react-i18next#useTranslation
- @fortawesome/react-fontawesome#FontAwesomeIcon
- @mui/material#Box
- @mui/material#Typography
- @mui/material#useTheme
- @mui/material#Skeleton
- @mui/material#Autocomplete
- @mui/icons-material#BusinessCenter
- @mui/icons-material#Favorite
@fortawesome/free-solid-svg-icons#faUserShield TypeScript Examples
The following examples show how to use
@fortawesome/free-solid-svg-icons#faUserShield.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CharacterAutocomplete.tsx From genshin-optimizer with MIT License | 4 votes |
export default function CharacterAutocomplete({ value, onChange, defaultText = "", defaultIcon = "", placeholderText = "", labelText = "", showDefault = false, showInventory = false, showEquipped = false, filter = () => true, disable = () => false, ...props }: CharacterAutocompleteProps) {
// TODO: #412 We shouldn't be loading all the character translation files. Should have a separate lookup file for character name.
const { t } = useTranslation(["ui", "artifact", ...allCharacterKeys.map(k => `char_${k}_gen`)])
const theme = useTheme()
const { database } = useContext(DatabaseContext)
const characterSheets = usePromise(CharacterSheet.getAll, [])
const filterConfigs = useMemo(() => characterSheets && characterFilterConfigs(database, characterSheets), [database, characterSheets])
const characterKeys = database._getCharKeys().filter(ck => characterSheets?.[ck] && filter(characterSheets[ck], ck)).sort()
const textForValue = useCallback((value: CharacterAutocompleteValue): string => {
switch (value) {
case "Equipped":
return t("artifact:filterLocation.currentlyEquipped")
case "Inventory":
return t("artifact:filterLocation.inventory")
case "":
return defaultText
default:
return t(`char_${value}_gen:name`)
}
}, [defaultText, t])
const imageForValue = useCallback((value: CharacterAutocompleteValue): Displayable => {
switch (value) {
case "Equipped":
return <FontAwesomeIcon icon={faUserShield} />
case "Inventory":
return <BusinessCenter />
case "":
return defaultIcon
default:
return <ThumbSide src={characterSheets![value]?.thumbImgSide} sx={{ pr: 1 }} />
}
}, [defaultIcon, characterSheets])
const characterOptions = useMemo(() => filterConfigs && charOptions(characterKeys, filterConfigs, textForValue, showDefault, showInventory, showEquipped),
[filterConfigs, characterKeys, showDefault, showInventory, showEquipped, textForValue])
if (!characterSheets || !characterOptions) return null
return <Autocomplete
autoHighlight
options={characterOptions}
getOptionLabel={(option) => option.label}
onChange={(_, newValue) => onChange(newValue ? newValue.value : "")}
isOptionEqualToValue={(option, value) => option.value === value.value}
getOptionDisabled={option => option.value ? disable(option.value) : false}
value={{ value, label: textForValue(value) }}
renderInput={(props) => <SolidColoredTextField
{...props}
label={labelText}
placeholder={placeholderText}
startAdornment={imageForValue(value)}
hasValue={value ? true : false}
/>}
renderOption={(props, option) => {
const favorite = option.value !== "Equipped" && option.value !== "Inventory"
&& option.value !== "" && database._getChar(option.value)?.favorite
return <MenuItemWithImage
key={option.value ? option.value : "default"}
value={option.value ? option.value : "default"}
image={imageForValue(option.value)}
text={
<Suspense fallback={<Skeleton variant="text" width={100} />}>
<Typography variant="inherit" noWrap>
{textForValue(option.value)}
</Typography>
</Suspense>
}
theme={theme}
isSelected={value === option.value}
addlElement={<>
{favorite && <Box display="flex" flexGrow={1} />}
{favorite && <Favorite sx={{ ml: 1, mr: -0.5 }} />}
</>}
props={props}
/>
}}
{...props}
/>
}